diff options
Diffstat (limited to 'deps/v8/src/full-codegen/arm/full-codegen-arm.cc')
-rw-r--r-- | deps/v8/src/full-codegen/arm/full-codegen-arm.cc | 951 |
1 files changed, 80 insertions, 871 deletions
diff --git a/deps/v8/src/full-codegen/arm/full-codegen-arm.cc b/deps/v8/src/full-codegen/arm/full-codegen-arm.cc index 22c991bed1..4b61bf9ab8 100644 --- a/deps/v8/src/full-codegen/arm/full-codegen-arm.cc +++ b/deps/v8/src/full-codegen/arm/full-codegen-arm.cc @@ -4,15 +4,16 @@ #if V8_TARGET_ARCH_ARM -#include "src/full-codegen/full-codegen.h" #include "src/ast/compile-time-value.h" #include "src/ast/scopes.h" +#include "src/builtins/builtins-constructor.h" #include "src/code-factory.h" #include "src/code-stubs.h" #include "src/codegen.h" #include "src/compilation-info.h" #include "src/compiler.h" #include "src/debug/debug.h" +#include "src/full-codegen/full-codegen.h" #include "src/ic/ic.h" #include "src/arm/code-stubs-arm.h" @@ -144,8 +145,6 @@ void FullCodeGenerator::Generate() { { Comment cmnt(masm_, "[ Allocate locals"); int locals_count = info->scope()->num_stack_slots(); - // Generators allocate locals, if any, in context slots. - DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); OperandStackDepthIncrement(locals_count); if (locals_count > 0) { if (locals_count >= 128) { @@ -200,15 +199,18 @@ void FullCodeGenerator::Generate() { if (info->scope()->new_target_var() != nullptr) { __ push(r3); // Preserve new target. } - if (slots <= FastNewFunctionContextStub::kMaximumSlots) { - FastNewFunctionContextStub stub(isolate()); + if (slots <= + ConstructorBuiltinsAssembler::MaximumFunctionContextSlots()) { + Callable callable = CodeFactory::FastNewFunctionContext( + isolate(), info->scope()->scope_type()); __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); - __ CallStub(&stub); - // Result of FastNewFunctionContextStub is always in new space. + __ Call(callable.code(), RelocInfo::CODE_TARGET); + // Result of the FastNewFunctionContext builtin is always in new space. need_write_barrier = false; } else { __ push(r1); + __ Push(Smi::FromInt(info->scope()->scope_type())); __ CallRuntime(Runtime::kNewFunctionContext); } if (info->scope()->new_target_var() != nullptr) { @@ -255,37 +257,10 @@ void FullCodeGenerator::Generate() { PrepareForBailoutForId(BailoutId::FunctionContext(), BailoutState::NO_REGISTERS); - // Possibly set up a local binding to the this function which is used in - // derived constructors with super calls. - Variable* this_function_var = info->scope()->this_function_var(); - if (this_function_var != nullptr) { - Comment cmnt(masm_, "[ This function"); - if (!function_in_register_r1) { - __ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); - // The write barrier clobbers register again, keep it marked as such. - } - SetVar(this_function_var, r1, r0, r2); - } - - // Possibly set up a local binding to the new target value. - Variable* new_target_var = info->scope()->new_target_var(); - if (new_target_var != nullptr) { - Comment cmnt(masm_, "[ new.target"); - SetVar(new_target_var, r3, r0, r2); - } - - // Possibly allocate RestParameters - Variable* rest_param = info->scope()->rest_parameter(); - if (rest_param != nullptr) { - Comment cmnt(masm_, "[ Allocate rest parameter array"); - if (!function_in_register_r1) { - __ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); - } - FastNewRestParameterStub stub(isolate()); - __ CallStub(&stub); - function_in_register_r1 = false; - SetVar(rest_param, r0, r1, r2); - } + // We don't support new.target and rest parameters here. + DCHECK_NULL(info->scope()->new_target_var()); + DCHECK_NULL(info->scope()->rest_parameter()); + DCHECK_NULL(info->scope()->this_function_var()); Variable* arguments = info->scope()->arguments(); if (arguments != NULL) { @@ -554,10 +529,8 @@ void FullCodeGenerator::TestContext::Plug(Handle<Object> lit) const { true, true_label_, false_label_); - DCHECK(lit->IsNull(isolate()) || lit->IsUndefined(isolate()) || - !lit->IsUndetectable()); - if (lit->IsUndefined(isolate()) || lit->IsNull(isolate()) || - lit->IsFalse(isolate())) { + DCHECK(lit->IsNullOrUndefined(isolate()) || !lit->IsUndetectable()); + if (lit->IsNullOrUndefined(isolate()) || lit->IsFalse(isolate())) { if (false_label_ != fall_through_) __ b(false_label_); } else if (lit->IsTrue(isolate()) || lit->IsJSObject()) { if (true_label_ != fall_through_) __ b(true_label_); @@ -783,6 +756,7 @@ void FullCodeGenerator::VisitVariableDeclaration( switch (variable->location()) { case VariableLocation::UNALLOCATED: { DCHECK(!variable->binding_needs_init()); + globals_->Add(variable->name(), zone()); FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); DCHECK(!slot.IsInvalid()); globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); @@ -809,17 +783,7 @@ void FullCodeGenerator::VisitVariableDeclaration( } break; - case VariableLocation::LOOKUP: { - Comment cmnt(masm_, "[ VariableDeclaration"); - DCHECK_EQ(VAR, variable->mode()); - DCHECK(!variable->binding_needs_init()); - __ mov(r2, Operand(variable->name())); - __ Push(r2); - __ CallRuntime(Runtime::kDeclareEvalVar); - PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); - break; - } - + case VariableLocation::LOOKUP: case VariableLocation::MODULE: UNREACHABLE(); } @@ -832,6 +796,7 @@ void FullCodeGenerator::VisitFunctionDeclaration( Variable* variable = proxy->var(); switch (variable->location()) { case VariableLocation::UNALLOCATED: { + globals_->Add(variable->name(), zone()); FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); DCHECK(!slot.IsInvalid()); globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); @@ -870,17 +835,7 @@ void FullCodeGenerator::VisitFunctionDeclaration( break; } - case VariableLocation::LOOKUP: { - Comment cmnt(masm_, "[ FunctionDeclaration"); - __ mov(r2, Operand(variable->name())); - PushOperand(r2); - // Push initial value for function declaration. - VisitForStackValue(declaration->fun()); - CallRuntimeWithOperands(Runtime::kDeclareEvalFunction); - PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); - break; - } - + case VariableLocation::LOOKUP: case VariableLocation::MODULE: UNREACHABLE(); } @@ -1184,92 +1139,6 @@ void FullCodeGenerator::EmitSetHomeObjectAccumulator(Expression* initializer, CallStoreIC(slot, isolate()->factory()->home_object_symbol()); } - -void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, - TypeofMode typeof_mode, - Label* slow) { - Register current = cp; - Register next = r1; - Register temp = r2; - - int to_check = scope()->ContextChainLengthUntilOutermostSloppyEval(); - for (Scope* s = scope(); to_check > 0; s = s->outer_scope()) { - if (!s->NeedsContext()) continue; - if (s->calls_sloppy_eval()) { - // Check that extension is "the hole". - __ ldr(temp, ContextMemOperand(current, Context::EXTENSION_INDEX)); - __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow); - } - // Load next context in chain. - __ ldr(next, ContextMemOperand(current, Context::PREVIOUS_INDEX)); - // Walk the rest of the chain without clobbering cp. - current = next; - to_check--; - } - - // All extension objects were empty and it is safe to use a normal global - // load machinery. - EmitGlobalVariableLoad(proxy, typeof_mode); -} - - -MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, - Label* slow) { - DCHECK(var->IsContextSlot()); - Register context = cp; - Register next = r3; - Register temp = r4; - - for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) { - if (s->NeedsContext()) { - if (s->calls_sloppy_eval()) { - // Check that extension is "the hole". - __ ldr(temp, ContextMemOperand(context, Context::EXTENSION_INDEX)); - __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow); - } - __ ldr(next, ContextMemOperand(context, Context::PREVIOUS_INDEX)); - // Walk the rest of the chain without clobbering cp. - context = next; - } - } - // Check that last extension is "the hole". - __ ldr(temp, ContextMemOperand(context, Context::EXTENSION_INDEX)); - __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow); - - // This function is used only for loads, not stores, so it's safe to - // return an cp-based operand (the write barrier cannot be allowed to - // destroy the cp register). - return ContextMemOperand(context, var->index()); -} - - -void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, - TypeofMode typeof_mode, - Label* slow, Label* done) { - // Generate fast-case code for variables that might be shadowed by - // eval-introduced variables. Eval is used a lot without - // introducing variables. In those cases, we do not want to - // perform a runtime call for all variables in the scope - // containing the eval. - Variable* var = proxy->var(); - if (var->mode() == DYNAMIC_GLOBAL) { - EmitLoadGlobalCheckExtensions(proxy, typeof_mode, slow); - __ jmp(done); - } else if (var->mode() == DYNAMIC_LOCAL) { - Variable* local = var->local_if_not_shadowed(); - __ ldr(r0, ContextSlotOperandCheckExtensions(local, slow)); - if (local->binding_needs_init()) { - __ CompareRoot(r0, Heap::kTheHoleValueRootIndex); - __ b(ne, done); - __ mov(r0, Operand(var->name())); - __ push(r0); - __ CallRuntime(Runtime::kThrowReferenceError); - } else { - __ jmp(done); - } - } -} - void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, TypeofMode typeof_mode) { // Record position before possible IC call. @@ -1277,8 +1146,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, PrepareForBailoutForId(proxy->BeforeId(), BailoutState::NO_REGISTERS); Variable* var = proxy->var(); - // Three cases: global variables, lookup variables, and all other types of - // variables. + // Two cases: global variables and all other types of variables. switch (var->location()) { case VariableLocation::UNALLOCATED: { Comment cmnt(masm_, "[ Global variable"); @@ -1311,24 +1179,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, break; } - case VariableLocation::LOOKUP: { - Comment cmnt(masm_, "[ Lookup variable"); - Label done, slow; - // Generate code for loading from variables potentially shadowed - // by eval-introduced variables. - EmitDynamicLookupFastCase(proxy, typeof_mode, &slow, &done); - __ bind(&slow); - __ Push(var->name()); - Runtime::FunctionId function_id = - typeof_mode == NOT_INSIDE_TYPEOF - ? Runtime::kLoadLookupSlot - : Runtime::kLoadLookupSlotInsideTypeof; - __ CallRuntime(function_id); - __ bind(&done); - context()->Plug(r0); - break; - } - + case VariableLocation::LOOKUP: case VariableLocation::MODULE: UNREACHABLE(); } @@ -1355,7 +1206,8 @@ void FullCodeGenerator::EmitAccessor(ObjectLiteralProperty* property) { void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { Comment cmnt(masm_, "[ ObjectLiteral"); - Handle<FixedArray> constant_properties = expr->constant_properties(); + Handle<FixedArray> constant_properties = + expr->GetOrBuildConstantProperties(isolate()); __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); __ mov(r1, Operand(constant_properties)); @@ -1365,8 +1217,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { __ Push(r3, r2, r1, r0); __ CallRuntime(Runtime::kCreateObjectLiteral); } else { - FastCloneShallowObjectStub stub(isolate(), expr->properties_count()); - __ CallStub(&stub); + Callable callable = CodeFactory::FastCloneShallowObject( + isolate(), expr->properties_count()); + __ Call(callable.code(), RelocInfo::CODE_TARGET); RestoreContext(); } PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); @@ -1376,10 +1229,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { bool result_saved = false; AccessorTable accessor_table(zone()); - int property_index = 0; - for (; property_index < expr->properties()->length(); property_index++) { - ObjectLiteral::Property* property = expr->properties()->at(property_index); - if (property->is_computed_name()) break; + for (int i = 0; i < expr->properties()->length(); i++) { + ObjectLiteral::Property* property = expr->properties()->at(i); + DCHECK(!property->is_computed_name()); if (property->IsCompileTimeValue()) continue; Literal* key = property->key()->AsLiteral(); @@ -1389,6 +1241,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { result_saved = true; } switch (property->kind()) { + case ObjectLiteral::Property::SPREAD: case ObjectLiteral::Property::CONSTANT: UNREACHABLE(); case ObjectLiteral::Property::MATERIALIZED_LITERAL: @@ -1437,21 +1290,21 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { VisitForStackValue(value); DCHECK(property->emit_store()); CallRuntimeWithOperands(Runtime::kInternalSetPrototype); - PrepareForBailoutForId(expr->GetIdForPropertySet(property_index), + PrepareForBailoutForId(expr->GetIdForPropertySet(i), BailoutState::NO_REGISTERS); break; case ObjectLiteral::Property::GETTER: if (property->emit_store()) { AccessorTable::Iterator it = accessor_table.lookup(key); - it->second->bailout_id = expr->GetIdForPropertySet(property_index); + it->second->bailout_id = expr->GetIdForPropertySet(i); it->second->getter = property; } break; case ObjectLiteral::Property::SETTER: if (property->emit_store()) { AccessorTable::Iterator it = accessor_table.lookup(key); - it->second->bailout_id = expr->GetIdForPropertySet(property_index); + it->second->bailout_id = expr->GetIdForPropertySet(i); it->second->setter = property; } break; @@ -1474,73 +1327,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS); } - // Object literals have two parts. The "static" part on the left contains no - // computed property names, and so we can compute its map ahead of time; see - // runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part - // starts with the first computed property name, and continues with all - // properties to its right. All the code from above initializes the static - // component of the object literal, and arranges for the map of the result to - // reflect the static order in which the keys appear. For the dynamic - // properties, we compile them into a series of "SetOwnProperty" runtime - // calls. This will preserve insertion order. - for (; property_index < expr->properties()->length(); property_index++) { - ObjectLiteral::Property* property = expr->properties()->at(property_index); - - Expression* value = property->value(); - if (!result_saved) { - PushOperand(r0); // Save result on the stack - result_saved = true; - } - - __ ldr(r0, MemOperand(sp)); // Duplicate receiver. - PushOperand(r0); - - if (property->kind() == ObjectLiteral::Property::PROTOTYPE) { - DCHECK(!property->is_computed_name()); - VisitForStackValue(value); - DCHECK(property->emit_store()); - CallRuntimeWithOperands(Runtime::kInternalSetPrototype); - PrepareForBailoutForId(expr->GetIdForPropertySet(property_index), - BailoutState::NO_REGISTERS); - } else { - EmitPropertyKey(property, expr->GetIdForPropertyName(property_index)); - VisitForStackValue(value); - if (NeedsHomeObject(value)) { - EmitSetHomeObject(value, 2, property->GetSlot()); - } - - switch (property->kind()) { - case ObjectLiteral::Property::CONSTANT: - case ObjectLiteral::Property::MATERIALIZED_LITERAL: - case ObjectLiteral::Property::COMPUTED: - if (property->emit_store()) { - PushOperand(Smi::FromInt(NONE)); - PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); - CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); - PrepareForBailoutForId(expr->GetIdForPropertySet(property_index), - BailoutState::NO_REGISTERS); - } else { - DropOperands(3); - } - break; - - case ObjectLiteral::Property::PROTOTYPE: - UNREACHABLE(); - break; - - case ObjectLiteral::Property::GETTER: - PushOperand(Smi::FromInt(NONE)); - CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); - break; - - case ObjectLiteral::Property::SETTER: - PushOperand(Smi::FromInt(NONE)); - CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); - break; - } - } - } - if (result_saved) { context()->PlugTOS(); } else { @@ -1552,11 +1338,10 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { Comment cmnt(masm_, "[ ArrayLiteral"); - Handle<FixedArray> constant_elements = expr->constant_elements(); + Handle<ConstantElementsPair> constant_elements = + expr->GetOrBuildConstantElements(isolate()); bool has_fast_elements = IsFastObjectElementsKind(expr->constant_elements_kind()); - Handle<FixedArrayBase> constant_elements_values( - FixedArrayBase::cast(constant_elements->get(1))); AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; if (has_fast_elements && !FLAG_allocation_site_pretenuring) { @@ -1573,8 +1358,9 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { __ Push(r3, r2, r1, r0); __ CallRuntime(Runtime::kCreateArrayLiteral); } else { - FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); - __ CallStub(&stub); + Callable callable = + CodeFactory::FastCloneShallowArray(isolate(), allocation_site_mode); + __ Call(callable.code(), RelocInfo::CODE_TARGET); RestoreContext(); } PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); @@ -1637,35 +1423,6 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { VisitForStackValue(property->obj()); } break; - case NAMED_SUPER_PROPERTY: - VisitForStackValue( - property->obj()->AsSuperPropertyReference()->this_var()); - VisitForAccumulatorValue( - property->obj()->AsSuperPropertyReference()->home_object()); - PushOperand(result_register()); - if (expr->is_compound()) { - const Register scratch = r1; - __ ldr(scratch, MemOperand(sp, kPointerSize)); - PushOperand(scratch); - PushOperand(result_register()); - } - break; - case KEYED_SUPER_PROPERTY: - VisitForStackValue( - property->obj()->AsSuperPropertyReference()->this_var()); - VisitForStackValue( - property->obj()->AsSuperPropertyReference()->home_object()); - VisitForAccumulatorValue(property->key()); - PushOperand(result_register()); - if (expr->is_compound()) { - const Register scratch = r1; - __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); - PushOperand(scratch); - __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); - PushOperand(scratch); - PushOperand(result_register()); - } - break; case KEYED_PROPERTY: if (expr->is_compound()) { VisitForStackValue(property->obj()); @@ -1678,6 +1435,10 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { VisitForStackValue(property->key()); } break; + case NAMED_SUPER_PROPERTY: + case KEYED_SUPER_PROPERTY: + UNREACHABLE(); + break; } // For compound assignments we need another deoptimization point after the @@ -1694,21 +1455,15 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { PrepareForBailoutForId(property->LoadId(), BailoutState::TOS_REGISTER); break; - case NAMED_SUPER_PROPERTY: - EmitNamedSuperPropertyLoad(property); - PrepareForBailoutForId(property->LoadId(), - BailoutState::TOS_REGISTER); - break; - case KEYED_SUPER_PROPERTY: - EmitKeyedSuperPropertyLoad(property); - PrepareForBailoutForId(property->LoadId(), - BailoutState::TOS_REGISTER); - break; case KEYED_PROPERTY: EmitKeyedPropertyLoad(property); PrepareForBailoutForId(property->LoadId(), BailoutState::TOS_REGISTER); break; + case NAMED_SUPER_PROPERTY: + case KEYED_SUPER_PROPERTY: + UNREACHABLE(); + break; } } @@ -1747,72 +1502,20 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { case NAMED_PROPERTY: EmitNamedPropertyAssignment(expr); break; - case NAMED_SUPER_PROPERTY: - EmitNamedSuperPropertyStore(property); - context()->Plug(r0); - break; - case KEYED_SUPER_PROPERTY: - EmitKeyedSuperPropertyStore(property); - context()->Plug(r0); - break; case KEYED_PROPERTY: EmitKeyedPropertyAssignment(expr); break; + case NAMED_SUPER_PROPERTY: + case KEYED_SUPER_PROPERTY: + UNREACHABLE(); + break; } } void FullCodeGenerator::VisitYield(Yield* expr) { - Comment cmnt(masm_, "[ Yield"); - SetExpressionPosition(expr); - - // Evaluate yielded value first; the initial iterator definition depends on - // this. It stays on the stack while we update the iterator. - VisitForStackValue(expr->expression()); - - Label suspend, continuation, post_runtime, resume, exception; - - __ jmp(&suspend); - __ bind(&continuation); - // When we arrive here, r0 holds the generator object. - __ RecordGeneratorContinuation(); - __ ldr(r1, FieldMemOperand(r0, JSGeneratorObject::kResumeModeOffset)); - __ ldr(r0, FieldMemOperand(r0, JSGeneratorObject::kInputOrDebugPosOffset)); - STATIC_ASSERT(JSGeneratorObject::kNext < JSGeneratorObject::kReturn); - STATIC_ASSERT(JSGeneratorObject::kThrow > JSGeneratorObject::kReturn); - __ cmp(r1, Operand(Smi::FromInt(JSGeneratorObject::kReturn))); - __ b(lt, &resume); - __ Push(result_register()); - __ b(gt, &exception); - EmitCreateIteratorResult(true); - EmitUnwindAndReturn(); - - __ bind(&exception); - __ CallRuntime(expr->rethrow_on_exception() ? Runtime::kReThrow - : Runtime::kThrow); - - __ bind(&suspend); - OperandStackDepthIncrement(1); // Not popped on this path. - VisitForAccumulatorValue(expr->generator_object()); - DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); - __ mov(r1, Operand(Smi::FromInt(continuation.pos()))); - __ str(r1, FieldMemOperand(r0, JSGeneratorObject::kContinuationOffset)); - __ str(cp, FieldMemOperand(r0, JSGeneratorObject::kContextOffset)); - __ mov(r1, cp); - __ RecordWriteField(r0, JSGeneratorObject::kContextOffset, r1, r2, - kLRHasBeenSaved, kDontSaveFPRegs); - __ add(r1, fp, Operand(StandardFrameConstants::kExpressionsOffset)); - __ cmp(sp, r1); - __ b(eq, &post_runtime); - __ push(r0); // generator object - __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); - RestoreContext(); - __ bind(&post_runtime); - PopOperand(result_register()); - EmitReturnSequence(); - - __ bind(&resume); - context()->Plug(result_register()); + // Resumable functions are not supported. + UNREACHABLE(); } void FullCodeGenerator::PushOperands(Register reg1, Register reg2) { @@ -1952,60 +1655,6 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, context()->Plug(r0); } - -void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { - for (int i = 0; i < lit->properties()->length(); i++) { - ClassLiteral::Property* property = lit->properties()->at(i); - Expression* value = property->value(); - - Register scratch = r1; - if (property->is_static()) { - __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor - } else { - __ ldr(scratch, MemOperand(sp, 0)); // prototype - } - PushOperand(scratch); - EmitPropertyKey(property, lit->GetIdForProperty(i)); - - // The static prototype property is read only. We handle the non computed - // property name case in the parser. Since this is the only case where we - // need to check for an own read only property we special case this so we do - // not need to do this for every property. - if (property->is_static() && property->is_computed_name()) { - __ CallRuntime(Runtime::kThrowIfStaticPrototype); - __ push(r0); - } - - VisitForStackValue(value); - if (NeedsHomeObject(value)) { - EmitSetHomeObject(value, 2, property->GetSlot()); - } - - switch (property->kind()) { - case ClassLiteral::Property::METHOD: - PushOperand(Smi::FromInt(DONT_ENUM)); - PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); - CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); - break; - - case ClassLiteral::Property::GETTER: - PushOperand(Smi::FromInt(DONT_ENUM)); - CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); - break; - - case ClassLiteral::Property::SETTER: - PushOperand(Smi::FromInt(DONT_ENUM)); - CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); - break; - - case ClassLiteral::Property::FIELD: - default: - UNREACHABLE(); - } - } -} - - void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { PopOperand(r1); Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); @@ -2039,43 +1688,6 @@ void FullCodeGenerator::EmitAssignment(Expression* expr, CallStoreIC(slot, prop->key()->AsLiteral()->value()); break; } - case NAMED_SUPER_PROPERTY: { - PushOperand(r0); - VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); - VisitForAccumulatorValue( - prop->obj()->AsSuperPropertyReference()->home_object()); - // stack: value, this; r0: home_object - Register scratch = r2; - Register scratch2 = r3; - __ mov(scratch, result_register()); // home_object - __ ldr(r0, MemOperand(sp, kPointerSize)); // value - __ ldr(scratch2, MemOperand(sp, 0)); // this - __ str(scratch2, MemOperand(sp, kPointerSize)); // this - __ str(scratch, MemOperand(sp, 0)); // home_object - // stack: this, home_object; r0: value - EmitNamedSuperPropertyStore(prop); - break; - } - case KEYED_SUPER_PROPERTY: { - PushOperand(r0); - VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); - VisitForStackValue( - prop->obj()->AsSuperPropertyReference()->home_object()); - VisitForAccumulatorValue(prop->key()); - Register scratch = r2; - Register scratch2 = r3; - __ ldr(scratch2, MemOperand(sp, 2 * kPointerSize)); // value - // stack: value, this, home_object; r0: key, r3: value - __ ldr(scratch, MemOperand(sp, kPointerSize)); // this - __ str(scratch, MemOperand(sp, 2 * kPointerSize)); - __ ldr(scratch, MemOperand(sp, 0)); // home_object - __ str(scratch, MemOperand(sp, kPointerSize)); - __ str(r0, MemOperand(sp, 0)); - __ Move(r0, scratch2); - // stack: this, home_object, key; r0: value. - EmitKeyedSuperPropertyStore(prop); - break; - } case KEYED_PROPERTY: { PushOperand(r0); // Preserve value. VisitForStackValue(prop->obj()); @@ -2086,6 +1698,10 @@ void FullCodeGenerator::EmitAssignment(Expression* expr, CallKeyedStoreIC(slot); break; } + case NAMED_SUPER_PROPERTY: + case KEYED_SUPER_PROPERTY: + UNREACHABLE(); + break; } context()->Plug(r0); } @@ -2147,26 +1763,18 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, } else { DCHECK(var->mode() != CONST || op == Token::INIT); - if (var->IsLookupSlot()) { - // Assignment to var. - __ Push(var->name()); - __ Push(r0); - __ CallRuntime(is_strict(language_mode()) - ? Runtime::kStoreLookupSlot_Strict - : Runtime::kStoreLookupSlot_Sloppy); - } else { - // Assignment to var or initializing assignment to let/const in harmony - // mode. - DCHECK((var->IsStackAllocated() || var->IsContextSlot())); - MemOperand location = VarOperand(var, r1); - if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { - // Check for an uninitialized let binding. - __ ldr(r2, location); - __ CompareRoot(r2, Heap::kTheHoleValueRootIndex); - __ Check(eq, kLetBindingReInitialization); - } - EmitStoreToStackLocalOrContextSlot(var, location); + DCHECK(var->IsStackAllocated() || var->IsContextSlot()); + DCHECK(!var->IsLookupSlot()); + // Assignment to var or initializing assignment to let/const in harmony + // mode. + MemOperand location = VarOperand(var, r1); + if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { + // Check for an uninitialized let binding. + __ ldr(r2, location); + __ CompareRoot(r2, Heap::kTheHoleValueRootIndex); + __ Check(eq, kLetBindingReInitialization); } + EmitStoreToStackLocalOrContextSlot(var, location); } } @@ -2185,35 +1793,6 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { } -void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { - // Assignment to named property of super. - // r0 : value - // stack : receiver ('this'), home_object - DCHECK(prop != NULL); - Literal* key = prop->key()->AsLiteral(); - DCHECK(key != NULL); - - PushOperand(key->value()); - PushOperand(r0); - CallRuntimeWithOperands(is_strict(language_mode()) - ? Runtime::kStoreToSuper_Strict - : Runtime::kStoreToSuper_Sloppy); -} - - -void FullCodeGenerator::EmitKeyedSuperPropertyStore(Property* prop) { - // Assignment to named property of super. - // r0 : value - // stack : receiver ('this'), home_object, key - DCHECK(prop != NULL); - - PushOperand(r0); - CallRuntimeWithOperands(is_strict(language_mode()) - ? Runtime::kStoreKeyedToSuper_Strict - : Runtime::kStoreKeyedToSuper_Sloppy); -} - - void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { // Assignment to a property, using a keyed store IC. PopOperands(StoreDescriptor::ReceiverRegister(), @@ -2261,45 +1840,6 @@ void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { } -void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { - Expression* callee = expr->expression(); - DCHECK(callee->IsProperty()); - Property* prop = callee->AsProperty(); - DCHECK(prop->IsSuperAccess()); - SetExpressionPosition(prop); - - Literal* key = prop->key()->AsLiteral(); - DCHECK(!key->value()->IsSmi()); - // Load the function from the receiver. - const Register scratch = r1; - SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); - VisitForStackValue(super_ref->home_object()); - VisitForAccumulatorValue(super_ref->this_var()); - PushOperand(r0); - PushOperand(r0); - __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); - PushOperand(scratch); - PushOperand(key->value()); - - // Stack here: - // - home_object - // - this (receiver) - // - this (receiver) <-- LoadFromSuper will pop here and below. - // - home_object - // - key - CallRuntimeWithOperands(Runtime::kLoadFromSuper); - PrepareForBailoutForId(prop->LoadId(), BailoutState::TOS_REGISTER); - - // Replace home_object with target function. - __ str(r0, MemOperand(sp, kPointerSize)); - - // Stack here: - // - target function - // - this (receiver) - EmitCall(expr); -} - - // Code common for calls using the IC. void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, Expression* key) { @@ -2325,43 +1865,6 @@ void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, } -void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { - Expression* callee = expr->expression(); - DCHECK(callee->IsProperty()); - Property* prop = callee->AsProperty(); - DCHECK(prop->IsSuperAccess()); - - SetExpressionPosition(prop); - // Load the function from the receiver. - const Register scratch = r1; - SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); - VisitForStackValue(super_ref->home_object()); - VisitForAccumulatorValue(super_ref->this_var()); - PushOperand(r0); - PushOperand(r0); - __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); - PushOperand(scratch); - VisitForStackValue(prop->key()); - - // Stack here: - // - home_object - // - this (receiver) - // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. - // - home_object - // - key - CallRuntimeWithOperands(Runtime::kLoadKeyedFromSuper); - PrepareForBailoutForId(prop->LoadId(), BailoutState::TOS_REGISTER); - - // Replace home_object with target function. - __ str(r0, MemOperand(sp, kPointerSize)); - - // Stack here: - // - target function - // - this (receiver) - EmitCall(expr); -} - - void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { // Load the arguments. ZoneList<Expression*>* args = expr->arguments(); @@ -2393,116 +1896,6 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { context()->DropAndPlug(1, r0); } -void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) { - int arg_count = expr->arguments()->length(); - // r4: copy of the first argument or undefined if it doesn't exist. - if (arg_count > 0) { - __ ldr(r4, MemOperand(sp, arg_count * kPointerSize)); - } else { - __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); - } - - // r3: the receiver of the enclosing function. - __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); - - // r2: language mode. - __ mov(r2, Operand(Smi::FromInt(language_mode()))); - - // r1: the start position of the scope the calls resides in. - __ mov(r1, Operand(Smi::FromInt(scope()->start_position()))); - - // r0: the source position of the eval call. - __ mov(r0, Operand(Smi::FromInt(expr->position()))); - - // Do the runtime call. - __ Push(r4, r3, r2, r1, r0); - __ CallRuntime(Runtime::kResolvePossiblyDirectEval); -} - - -// See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. -void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { - VariableProxy* callee = expr->expression()->AsVariableProxy(); - if (callee->var()->IsLookupSlot()) { - Label slow, done; - SetExpressionPosition(callee); - // Generate code for loading from variables potentially shadowed - // by eval-introduced variables. - EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); - - __ bind(&slow); - // Call the runtime to find the function to call (returned in r0) - // and the object holding it (returned in edx). - __ Push(callee->name()); - __ CallRuntime(Runtime::kLoadLookupSlotForCall); - PushOperands(r0, r1); // Function, receiver. - PrepareForBailoutForId(expr->LookupId(), BailoutState::NO_REGISTERS); - - // If fast case code has been generated, emit code to push the - // function and receiver and have the slow path jump around this - // code. - if (done.is_linked()) { - Label call; - __ b(&call); - __ bind(&done); - // Push function. - __ push(r0); - // The receiver is implicitly the global receiver. Indicate this - // by passing the hole to the call function stub. - __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); - __ push(r1); - __ bind(&call); - } - } else { - VisitForStackValue(callee); - // refEnv.WithBaseObject() - __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); - PushOperand(r2); // Reserved receiver slot. - } -} - - -void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { - // In a call to eval, we first call - // Runtime_ResolvePossiblyDirectEval to resolve the function we need - // to call. Then we call the resolved function using the given arguments. - ZoneList<Expression*>* args = expr->arguments(); - int arg_count = args->length(); - - PushCalleeAndWithBaseObject(expr); - - // Push the arguments. - for (int i = 0; i < arg_count; i++) { - VisitForStackValue(args->at(i)); - } - - // Push a copy of the function (found below the arguments) and - // resolve eval. - __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); - __ push(r1); - EmitResolvePossiblyDirectEval(expr); - - // Touch up the stack with the resolved function. - __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); - - PrepareForBailoutForId(expr->EvalId(), BailoutState::NO_REGISTERS); - - // Record source position for debugger. - SetCallPosition(expr); - Handle<Code> code = CodeFactory::CallIC(isolate(), ConvertReceiverMode::kAny, - expr->tail_call_mode()) - .code(); - __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); - __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); - __ mov(r0, Operand(arg_count)); - __ Call(code, RelocInfo::CODE_TARGET); - OperandStackDepthDecrement(arg_count + 1); - RecordJSReturnSite(expr); - RestoreContext(); - context()->DropAndPlug(1, r0); -} - - void FullCodeGenerator::VisitCallNew(CallNew* expr) { Comment cmnt(masm_, "[ CallNew"); // According to ECMA-262, section 11.2.2, page 44, the function @@ -2543,49 +1936,6 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { } -void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { - SuperCallReference* super_call_ref = - expr->expression()->AsSuperCallReference(); - DCHECK_NOT_NULL(super_call_ref); - - // Push the super constructor target on the stack (may be null, - // but the Construct builtin can deal with that properly). - VisitForAccumulatorValue(super_call_ref->this_function_var()); - __ AssertFunction(result_register()); - __ ldr(result_register(), - FieldMemOperand(result_register(), HeapObject::kMapOffset)); - __ ldr(result_register(), - FieldMemOperand(result_register(), Map::kPrototypeOffset)); - PushOperand(result_register()); - - // Push the arguments ("left-to-right") on the stack. - ZoneList<Expression*>* args = expr->arguments(); - int arg_count = args->length(); - for (int i = 0; i < arg_count; i++) { - VisitForStackValue(args->at(i)); - } - - // Call the construct call builtin that handles allocation and - // constructor invocation. - SetConstructCallPosition(expr); - - // Load new target into r3. - VisitForAccumulatorValue(super_call_ref->new_target_var()); - __ mov(r3, result_register()); - - // Load function and argument count into r1 and r0. - __ mov(r0, Operand(arg_count)); - __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); - - __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); - OperandStackDepthDecrement(arg_count + 1); - - RecordJSReturnSite(expr); - RestoreContext(); - context()->Plug(r0); -} - - void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { ZoneList<Expression*>* args = expr->arguments(); DCHECK(args->length() == 1); @@ -2673,28 +2023,6 @@ void FullCodeGenerator::EmitIsTypedArray(CallRuntime* expr) { } -void FullCodeGenerator::EmitIsRegExp(CallRuntime* expr) { - ZoneList<Expression*>* args = expr->arguments(); - DCHECK(args->length() == 1); - - VisitForAccumulatorValue(args->at(0)); - - Label materialize_true, materialize_false; - Label* if_true = NULL; - Label* if_false = NULL; - Label* fall_through = NULL; - context()->PrepareTest(&materialize_true, &materialize_false, - &if_true, &if_false, &fall_through); - - __ JumpIfSmi(r0, if_false); - __ CompareObjectType(r0, r1, r1, JS_REGEXP_TYPE); - PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); - Split(eq, if_true, if_false, fall_through); - - context()->Plug(if_true, if_false); -} - - void FullCodeGenerator::EmitIsJSProxy(CallRuntime* expr) { ZoneList<Expression*>* args = expr->arguments(); DCHECK(args->length() == 1); @@ -2931,16 +2259,12 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { __ Push(r2, r1); __ CallRuntime(Runtime::kDeleteProperty_Sloppy); context()->Plug(r0); - } else if (var->IsStackAllocated() || var->IsContextSlot()) { + } else { + DCHECK(!var->IsLookupSlot()); + DCHECK(var->IsStackAllocated() || var->IsContextSlot()); // Result of deleting non-global, non-dynamic variables is false. // The subexpression does not have side effects. context()->Plug(is_this); - } else { - // Non-global variable. Call the runtime to try to delete from the - // context where the variable was introduced. - __ Push(var->name()); - __ CallRuntime(Runtime::kDeleteLookupSlot); - context()->Plug(r0); } } else { // Result of deleting non-property, non-variable reference is true. @@ -3046,35 +2370,6 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { break; } - case NAMED_SUPER_PROPERTY: { - VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); - VisitForAccumulatorValue( - prop->obj()->AsSuperPropertyReference()->home_object()); - PushOperand(result_register()); - const Register scratch = r1; - __ ldr(scratch, MemOperand(sp, kPointerSize)); - PushOperand(scratch); - PushOperand(result_register()); - EmitNamedSuperPropertyLoad(prop); - break; - } - - case KEYED_SUPER_PROPERTY: { - VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); - VisitForStackValue( - prop->obj()->AsSuperPropertyReference()->home_object()); - VisitForAccumulatorValue(prop->key()); - PushOperand(result_register()); - const Register scratch = r1; - __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); - PushOperand(scratch); - __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); - PushOperand(scratch); - PushOperand(result_register()); - EmitKeyedSuperPropertyLoad(prop); - break; - } - case KEYED_PROPERTY: { VisitForStackValue(prop->obj()); VisitForStackValue(prop->key()); @@ -3085,6 +2380,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { break; } + case NAMED_SUPER_PROPERTY: + case KEYED_SUPER_PROPERTY: case VARIABLE: UNREACHABLE(); } @@ -3120,14 +2417,12 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { case NAMED_PROPERTY: __ str(r0, MemOperand(sp, kPointerSize)); break; - case NAMED_SUPER_PROPERTY: - __ str(r0, MemOperand(sp, 2 * kPointerSize)); - break; case KEYED_PROPERTY: __ str(r0, MemOperand(sp, 2 * kPointerSize)); break; + case NAMED_SUPER_PROPERTY: case KEYED_SUPER_PROPERTY: - __ str(r0, MemOperand(sp, 3 * kPointerSize)); + UNREACHABLE(); break; } } @@ -3159,14 +2454,12 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { case NAMED_PROPERTY: __ str(r0, MemOperand(sp, kPointerSize)); break; - case NAMED_SUPER_PROPERTY: - __ str(r0, MemOperand(sp, 2 * kPointerSize)); - break; case KEYED_PROPERTY: __ str(r0, MemOperand(sp, 2 * kPointerSize)); break; + case NAMED_SUPER_PROPERTY: case KEYED_SUPER_PROPERTY: - __ str(r0, MemOperand(sp, 3 * kPointerSize)); + UNREACHABLE(); break; } } @@ -3223,30 +2516,6 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { } break; } - case NAMED_SUPER_PROPERTY: { - EmitNamedSuperPropertyStore(prop); - PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); - if (expr->is_postfix()) { - if (!context()->IsEffect()) { - context()->PlugTOS(); - } - } else { - context()->Plug(r0); - } - break; - } - case KEYED_SUPER_PROPERTY: { - EmitKeyedSuperPropertyStore(prop); - PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); - if (expr->is_postfix()) { - if (!context()->IsEffect()) { - context()->PlugTOS(); - } - } else { - context()->Plug(r0); - } - break; - } case KEYED_PROPERTY: { PopOperands(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister()); @@ -3261,6 +2530,10 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { } break; } + case NAMED_SUPER_PROPERTY: + case KEYED_SUPER_PROPERTY: + UNREACHABLE(); + break; } } @@ -3493,70 +2766,6 @@ void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { } -// ---------------------------------------------------------------------------- -// Non-local control flow support. - -void FullCodeGenerator::EnterFinallyBlock() { - DCHECK(!result_register().is(r1)); - // Store pending message while executing finally block. - ExternalReference pending_message_obj = - ExternalReference::address_of_pending_message_obj(isolate()); - __ mov(ip, Operand(pending_message_obj)); - __ ldr(r1, MemOperand(ip)); - PushOperand(r1); - - ClearPendingMessage(); -} - - -void FullCodeGenerator::ExitFinallyBlock() { - DCHECK(!result_register().is(r1)); - // Restore pending message from stack. - PopOperand(r1); - ExternalReference pending_message_obj = - ExternalReference::address_of_pending_message_obj(isolate()); - __ mov(ip, Operand(pending_message_obj)); - __ str(r1, MemOperand(ip)); -} - - -void FullCodeGenerator::ClearPendingMessage() { - DCHECK(!result_register().is(r1)); - ExternalReference pending_message_obj = - ExternalReference::address_of_pending_message_obj(isolate()); - __ LoadRoot(r1, Heap::kTheHoleValueRootIndex); - __ mov(ip, Operand(pending_message_obj)); - __ str(r1, MemOperand(ip)); -} - - -void FullCodeGenerator::DeferredCommands::EmitCommands() { - DCHECK(!result_register().is(r1)); - __ Pop(result_register()); // Restore the accumulator. - __ Pop(r1); // Get the token. - for (DeferredCommand cmd : commands_) { - Label skip; - __ cmp(r1, Operand(Smi::FromInt(cmd.token))); - __ b(ne, &skip); - switch (cmd.command) { - case kReturn: - codegen_->EmitUnwindAndReturn(); - break; - case kThrow: - __ Push(result_register()); - __ CallRuntime(Runtime::kReThrow); - break; - case kContinue: - codegen_->EmitContinue(cmd.target); - break; - case kBreak: - codegen_->EmitBreak(cmd.target); - break; - } - __ bind(&skip); - } -} - #undef __ |