diff options
| author | Ben Murdoch <benm@google.com> | 2011-11-30 16:04:58 +0000 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2011-12-02 17:28:30 +0000 |
| commit | 589d6979ff2ef66fca2d8fa51404c369ca5e9250 (patch) | |
| tree | 1d9032fcae9d18a05430a4ba9c14e5c635c4096e /src/full-codegen.cc | |
| parent | 69a99ed0b2b2ef69d393c371b03db3a98aaf880e (diff) | |
| download | android_external_v8-589d6979ff2ef66fca2d8fa51404c369ca5e9250.tar.gz android_external_v8-589d6979ff2ef66fca2d8fa51404c369ca5e9250.tar.bz2 android_external_v8-589d6979ff2ef66fca2d8fa51404c369ca5e9250.zip | |
Upgrade to V8 3.6
Merge V8 at 3.6.6.11
Simple merge required updates to makefiles only.
Bug: 5688872
Change-Id: Ib38b7ffbcd409585f6cb6fccc59c767029cecc77
Diffstat (limited to 'src/full-codegen.cc')
| -rw-r--r-- | src/full-codegen.cc | 96 |
1 files changed, 35 insertions, 61 deletions
diff --git a/src/full-codegen.cc b/src/full-codegen.cc index ca2026bb..80738741 100644 --- a/src/full-codegen.cc +++ b/src/full-codegen.cc @@ -96,11 +96,6 @@ void BreakableStatementChecker::VisitWithStatement(WithStatement* stmt) { } -void BreakableStatementChecker::VisitExitContextStatement( - ExitContextStatement* stmt) { -} - - void BreakableStatementChecker::VisitSwitchStatement(SwitchStatement* stmt) { // Switch statements breakable if the tag expression is. Visit(stmt->tag()); @@ -190,9 +185,9 @@ void BreakableStatementChecker::VisitArrayLiteral(ArrayLiteral* expr) { void BreakableStatementChecker::VisitAssignment(Assignment* expr) { // If assigning to a property (including a global property) the assignment is // breakable. - Variable* var = expr->target()->AsVariableProxy()->AsVariable(); + VariableProxy* proxy = expr->target()->AsVariableProxy(); Property* prop = expr->target()->AsProperty(); - if (prop != NULL || (var != NULL && var->is_global())) { + if (prop != NULL || (proxy != NULL && proxy->var()->IsUnallocated())) { is_breakable_ = true; return; } @@ -291,11 +286,13 @@ bool FullCodeGenerator::MakeCode(CompilationInfo* info) { } unsigned table_offset = cgen.EmitStackCheckTable(); - Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, NOT_IN_LOOP); + Code::Flags flags = Code::ComputeFlags(Code::FUNCTION); Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); code->set_optimizable(info->IsOptimizable()); cgen.PopulateDeoptimizationData(code); code->set_has_deoptimization_support(info->HasDeoptimizationSupport()); + code->set_has_debug_break_slots( + info->isolate()->debugger()->IsDebuggerActive()); code->set_allow_osr_at_loop_nesting_level(0); code->set_stack_check_table_offset(table_offset); CodeGenerator::PrintCode(code, info); @@ -395,26 +392,6 @@ void FullCodeGenerator::RecordStackCheck(int ast_id) { } -int FullCodeGenerator::SlotOffset(Slot* slot) { - ASSERT(slot != NULL); - // Offset is negative because higher indexes are at lower addresses. - int offset = -slot->index() * kPointerSize; - // Adjust by a (parameter or local) base offset. - switch (slot->type()) { - case Slot::PARAMETER: - offset += (info_->scope()->num_parameters() + 1) * kPointerSize; - break; - case Slot::LOCAL: - offset += JavaScriptFrameConstants::kLocal0Offset; - break; - case Slot::CONTEXT: - case Slot::LOOKUP: - UNREACHABLE(); - } - return offset; -} - - bool FullCodeGenerator::ShouldInlineSmiCase(Token::Value op) { // Inline smi case inside loops, but not division and modulo which // are too complicated and take up too much space. @@ -529,34 +506,21 @@ void FullCodeGenerator::DoTest(const TestContext* context) { void FullCodeGenerator::VisitDeclarations( ZoneList<Declaration*>* declarations) { int length = declarations->length(); - int globals = 0; + int global_count = 0; for (int i = 0; i < length; i++) { Declaration* decl = declarations->at(i); - Variable* var = decl->proxy()->var(); - Slot* slot = var->AsSlot(); - - // If it was not possible to allocate the variable at compile - // time, we need to "declare" it at runtime to make sure it - // actually exists in the local context. - if ((slot != NULL && slot->type() == Slot::LOOKUP) || !var->is_global()) { - VisitDeclaration(decl); - } else { - // Count global variables and functions for later processing - globals++; - } + EmitDeclaration(decl->proxy(), decl->mode(), decl->fun(), &global_count); } - // Compute array of global variable and function declarations. - // Do nothing in case of no declared global functions or variables. - if (globals > 0) { + // Batch declare global functions and variables. + if (global_count > 0) { Handle<FixedArray> array = - isolate()->factory()->NewFixedArray(2 * globals, TENURED); + isolate()->factory()->NewFixedArray(2 * global_count, TENURED); for (int j = 0, i = 0; i < length; i++) { Declaration* decl = declarations->at(i); Variable* var = decl->proxy()->var(); - Slot* slot = var->AsSlot(); - if ((slot == NULL || slot->type() != Slot::LOOKUP) && var->is_global()) { + if (var->IsUnallocated()) { array->set(j++, *(var->name())); if (decl->fun() == NULL) { if (var->mode() == Variable::CONST) { @@ -578,12 +542,21 @@ void FullCodeGenerator::VisitDeclarations( } } // Invoke the platform-dependent code generator to do the actual - // declaration the global variables and functions. + // declaration the global functions and variables. DeclareGlobals(array); } } +int FullCodeGenerator::DeclareGlobalsFlags() { + int flags = 0; + if (is_eval()) flags |= kDeclareGlobalsEvalFlag; + if (is_strict_mode()) flags |= kDeclareGlobalsStrictModeFlag; + if (is_native()) flags |= kDeclareGlobalsNativeFlag; + return flags; +} + + void FullCodeGenerator::SetFunctionPosition(FunctionLiteral* fun) { CodeGenerator::RecordPositions(masm_, fun->start_position()); } @@ -842,10 +815,11 @@ void FullCodeGenerator::VisitInCurrentContext(Expression* expr) { void FullCodeGenerator::VisitBlock(Block* stmt) { Comment cmnt(masm_, "[ Block"); - Breakable nested_statement(this, stmt); + NestedBlock nested_block(this, stmt); SetStatementPosition(stmt); Scope* saved_scope = scope(); + // Push a block context when entering a block with block scoped variables. if (stmt->block_scope() != NULL) { { Comment cmnt(masm_, "[ Extend block context"); scope_ = stmt->block_scope(); @@ -862,8 +836,16 @@ void FullCodeGenerator::VisitBlock(Block* stmt) { PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); VisitStatements(stmt->statements()); scope_ = saved_scope; - __ bind(nested_statement.break_label()); + __ bind(nested_block.break_label()); PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); + + // Pop block context if necessary. + if (stmt->block_scope() != NULL) { + LoadContextField(context_register(), Context::PREVIOUS_INDEX); + // Update local stack frame context field. + StoreToFrameField(StandardFrameConstants::kContextOffset, + context_register()); + } } @@ -1004,17 +986,6 @@ void FullCodeGenerator::VisitWithStatement(WithStatement* stmt) { } -void FullCodeGenerator::VisitExitContextStatement(ExitContextStatement* stmt) { - Comment cmnt(masm_, "[ ExitContextStatement"); - SetStatementPosition(stmt); - - // Pop context. - LoadContextField(context_register(), Context::PREVIOUS_INDEX); - // Update local stack frame context field. - StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); -} - - void FullCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) { Comment cmnt(masm_, "[ DoWhileStatement"); SetStatementPosition(stmt); @@ -1162,6 +1133,9 @@ void FullCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) { { WithOrCatch body(this); Visit(stmt->catch_block()); } + // Restore the context. + LoadContextField(context_register(), Context::PREVIOUS_INDEX); + StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); scope_ = saved_scope; __ jmp(&done); |
