| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 | 1312 |
| 1313 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { | 1313 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { |
| 1314 Comment cnmt(masm_, "[ SuperReference "); | 1314 Comment cnmt(masm_, "[ SuperReference "); |
| 1315 | 1315 |
| 1316 __ ldr(LoadDescriptor::ReceiverRegister(), | 1316 __ ldr(LoadDescriptor::ReceiverRegister(), |
| 1317 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1317 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1318 | 1318 |
| 1319 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); | 1319 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); |
| 1320 __ Mov(LoadDescriptor::NameRegister(), Operand(home_object_symbol)); | 1320 __ Mov(LoadDescriptor::NameRegister(), Operand(home_object_symbol)); |
| 1321 | 1321 |
| 1322 __ Mov(VectorLoadICDescriptor::SlotRegister(), | 1322 __ Mov(LoadDescriptor::SlotRegister(), |
| 1323 SmiFromSlot(expr->HomeObjectFeedbackSlot())); | 1323 SmiFromSlot(expr->HomeObjectFeedbackSlot())); |
| 1324 CallLoadIC(NOT_CONTEXTUAL); | 1324 CallLoadIC(NOT_CONTEXTUAL); |
| 1325 | 1325 |
| 1326 __ Mov(x10, Operand(isolate()->factory()->undefined_value())); | 1326 __ Mov(x10, Operand(isolate()->factory()->undefined_value())); |
| 1327 __ cmp(x0, x10); | 1327 __ cmp(x0, x10); |
| 1328 Label done; | 1328 Label done; |
| 1329 __ b(&done, ne); | 1329 __ b(&done, ne); |
| 1330 __ CallRuntime(Runtime::kThrowNonMethodError, 0); | 1330 __ CallRuntime(Runtime::kThrowNonMethodError, 0); |
| 1331 __ bind(&done); | 1331 __ bind(&done); |
| 1332 } | 1332 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 __ Ldr(temp, ContextMemOperand(next, Context::EXTENSION_INDEX)); | 1382 __ Ldr(temp, ContextMemOperand(next, Context::EXTENSION_INDEX)); |
| 1383 __ Cbnz(temp, slow); | 1383 __ Cbnz(temp, slow); |
| 1384 // Load next context in chain. | 1384 // Load next context in chain. |
| 1385 __ Ldr(next, ContextMemOperand(next, Context::PREVIOUS_INDEX)); | 1385 __ Ldr(next, ContextMemOperand(next, Context::PREVIOUS_INDEX)); |
| 1386 __ B(&loop); | 1386 __ B(&loop); |
| 1387 __ Bind(&fast); | 1387 __ Bind(&fast); |
| 1388 } | 1388 } |
| 1389 | 1389 |
| 1390 __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); | 1390 __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); |
| 1391 __ Mov(LoadDescriptor::NameRegister(), Operand(proxy->var()->name())); | 1391 __ Mov(LoadDescriptor::NameRegister(), Operand(proxy->var()->name())); |
| 1392 __ Mov(VectorLoadICDescriptor::SlotRegister(), | 1392 __ Mov(LoadDescriptor::SlotRegister(), |
| 1393 SmiFromSlot(proxy->VariableFeedbackSlot())); | 1393 SmiFromSlot(proxy->VariableFeedbackSlot())); |
| 1394 | 1394 |
| 1395 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) ? NOT_CONTEXTUAL | 1395 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) ? NOT_CONTEXTUAL |
| 1396 : CONTEXTUAL; | 1396 : CONTEXTUAL; |
| 1397 CallLoadIC(mode); | 1397 CallLoadIC(mode); |
| 1398 } | 1398 } |
| 1399 | 1399 |
| 1400 | 1400 |
| 1401 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1401 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
| 1402 Label* slow) { | 1402 Label* slow) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); | 1466 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); |
| 1467 Variable* var = proxy->var(); | 1467 Variable* var = proxy->var(); |
| 1468 | 1468 |
| 1469 // Three cases: global variables, lookup variables, and all other types of | 1469 // Three cases: global variables, lookup variables, and all other types of |
| 1470 // variables. | 1470 // variables. |
| 1471 switch (var->location()) { | 1471 switch (var->location()) { |
| 1472 case Variable::UNALLOCATED: { | 1472 case Variable::UNALLOCATED: { |
| 1473 Comment cmnt(masm_, "Global variable"); | 1473 Comment cmnt(masm_, "Global variable"); |
| 1474 __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); | 1474 __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); |
| 1475 __ Mov(LoadDescriptor::NameRegister(), Operand(var->name())); | 1475 __ Mov(LoadDescriptor::NameRegister(), Operand(var->name())); |
| 1476 __ Mov(VectorLoadICDescriptor::SlotRegister(), | 1476 __ Mov(LoadDescriptor::SlotRegister(), |
| 1477 SmiFromSlot(proxy->VariableFeedbackSlot())); | 1477 SmiFromSlot(proxy->VariableFeedbackSlot())); |
| 1478 CallGlobalLoadIC(var->name()); | 1478 CallGlobalLoadIC(var->name()); |
| 1479 context()->Plug(x0); | 1479 context()->Plug(x0); |
| 1480 break; | 1480 break; |
| 1481 } | 1481 } |
| 1482 | 1482 |
| 1483 case Variable::PARAMETER: | 1483 case Variable::PARAMETER: |
| 1484 case Variable::LOCAL: | 1484 case Variable::LOCAL: |
| 1485 case Variable::CONTEXT: { | 1485 case Variable::CONTEXT: { |
| 1486 Comment cmnt(masm_, var->IsContextSlot() | 1486 Comment cmnt(masm_, var->IsContextSlot() |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2040 } | 2040 } |
| 2041 } | 2041 } |
| 2042 | 2042 |
| 2043 | 2043 |
| 2044 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2044 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 2045 SetSourcePosition(prop->position()); | 2045 SetSourcePosition(prop->position()); |
| 2046 Literal* key = prop->key()->AsLiteral(); | 2046 Literal* key = prop->key()->AsLiteral(); |
| 2047 DCHECK(!prop->IsSuperAccess()); | 2047 DCHECK(!prop->IsSuperAccess()); |
| 2048 | 2048 |
| 2049 __ Mov(LoadDescriptor::NameRegister(), Operand(key->value())); | 2049 __ Mov(LoadDescriptor::NameRegister(), Operand(key->value())); |
| 2050 __ Mov(VectorLoadICDescriptor::SlotRegister(), | 2050 __ Mov(LoadDescriptor::SlotRegister(), |
| 2051 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2051 SmiFromSlot(prop->PropertyFeedbackSlot())); |
| 2052 CallLoadIC(NOT_CONTEXTUAL); | 2052 CallLoadIC(NOT_CONTEXTUAL); |
| 2053 } | 2053 } |
| 2054 | 2054 |
| 2055 | 2055 |
| 2056 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2056 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
| 2057 // Stack: receiver, home_object. | 2057 // Stack: receiver, home_object. |
| 2058 SetSourcePosition(prop->position()); | 2058 SetSourcePosition(prop->position()); |
| 2059 Literal* key = prop->key()->AsLiteral(); | 2059 Literal* key = prop->key()->AsLiteral(); |
| 2060 DCHECK(!key->value()->IsSmi()); | 2060 DCHECK(!key->value()->IsSmi()); |
| 2061 DCHECK(prop->IsSuperAccess()); | 2061 DCHECK(prop->IsSuperAccess()); |
| 2062 | 2062 |
| 2063 __ Push(key->value()); | 2063 __ Push(key->value()); |
| 2064 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2064 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
| 2065 } | 2065 } |
| 2066 | 2066 |
| 2067 | 2067 |
| 2068 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2068 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2069 SetSourcePosition(prop->position()); | 2069 SetSourcePosition(prop->position()); |
| 2070 // Call keyed load IC. It has arguments key and receiver in x0 and x1. | 2070 // Call keyed load IC. It has arguments key and receiver in x0 and x1. |
| 2071 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2071 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
| 2072 __ Mov(VectorLoadICDescriptor::SlotRegister(), | 2072 __ Mov(LoadDescriptor::SlotRegister(), |
| 2073 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2073 SmiFromSlot(prop->PropertyFeedbackSlot())); |
| 2074 CallIC(ic); | 2074 CallIC(ic); |
| 2075 } | 2075 } |
| 2076 | 2076 |
| 2077 | 2077 |
| 2078 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2078 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
| 2079 // Stack: receiver, home_object, key. | 2079 // Stack: receiver, home_object, key. |
| 2080 SetSourcePosition(prop->position()); | 2080 SetSourcePosition(prop->position()); |
| 2081 | 2081 |
| 2082 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2082 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| (...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4291 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4291 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
| 4292 // Push the builtins object as the receiver. | 4292 // Push the builtins object as the receiver. |
| 4293 __ Ldr(x10, GlobalObjectMemOperand()); | 4293 __ Ldr(x10, GlobalObjectMemOperand()); |
| 4294 __ Ldr(LoadDescriptor::ReceiverRegister(), | 4294 __ Ldr(LoadDescriptor::ReceiverRegister(), |
| 4295 FieldMemOperand(x10, GlobalObject::kBuiltinsOffset)); | 4295 FieldMemOperand(x10, GlobalObject::kBuiltinsOffset)); |
| 4296 __ Push(LoadDescriptor::ReceiverRegister()); | 4296 __ Push(LoadDescriptor::ReceiverRegister()); |
| 4297 | 4297 |
| 4298 // Load the function from the receiver. | 4298 // Load the function from the receiver. |
| 4299 Handle<String> name = expr->name(); | 4299 Handle<String> name = expr->name(); |
| 4300 __ Mov(LoadDescriptor::NameRegister(), Operand(name)); | 4300 __ Mov(LoadDescriptor::NameRegister(), Operand(name)); |
| 4301 __ Mov(VectorLoadICDescriptor::SlotRegister(), | 4301 __ Mov(LoadDescriptor::SlotRegister(), |
| 4302 SmiFromSlot(expr->CallRuntimeFeedbackSlot())); | 4302 SmiFromSlot(expr->CallRuntimeFeedbackSlot())); |
| 4303 CallLoadIC(NOT_CONTEXTUAL); | 4303 CallLoadIC(NOT_CONTEXTUAL); |
| 4304 } | 4304 } |
| 4305 | 4305 |
| 4306 | 4306 |
| 4307 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4307 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
| 4308 ZoneList<Expression*>* args = expr->arguments(); | 4308 ZoneList<Expression*>* args = expr->arguments(); |
| 4309 int arg_count = args->length(); | 4309 int arg_count = args->length(); |
| 4310 | 4310 |
| 4311 // Record source position of the IC call. | 4311 // Record source position of the IC call. |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4721 | 4721 |
| 4722 | 4722 |
| 4723 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { | 4723 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
| 4724 DCHECK(!context()->IsEffect()); | 4724 DCHECK(!context()->IsEffect()); |
| 4725 DCHECK(!context()->IsTest()); | 4725 DCHECK(!context()->IsTest()); |
| 4726 VariableProxy* proxy = expr->AsVariableProxy(); | 4726 VariableProxy* proxy = expr->AsVariableProxy(); |
| 4727 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 4727 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
| 4728 Comment cmnt(masm_, "Global variable"); | 4728 Comment cmnt(masm_, "Global variable"); |
| 4729 __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); | 4729 __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); |
| 4730 __ Mov(LoadDescriptor::NameRegister(), Operand(proxy->name())); | 4730 __ Mov(LoadDescriptor::NameRegister(), Operand(proxy->name())); |
| 4731 __ Mov(VectorLoadICDescriptor::SlotRegister(), | 4731 __ Mov(LoadDescriptor::SlotRegister(), |
| 4732 SmiFromSlot(proxy->VariableFeedbackSlot())); | 4732 SmiFromSlot(proxy->VariableFeedbackSlot())); |
| 4733 // Use a regular load, not a contextual load, to avoid a reference | 4733 // Use a regular load, not a contextual load, to avoid a reference |
| 4734 // error. | 4734 // error. |
| 4735 CallLoadIC(NOT_CONTEXTUAL); | 4735 CallLoadIC(NOT_CONTEXTUAL); |
| 4736 PrepareForBailout(expr, TOS_REG); | 4736 PrepareForBailout(expr, TOS_REG); |
| 4737 context()->Plug(x0); | 4737 context()->Plug(x0); |
| 4738 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 4738 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
| 4739 Label done, slow; | 4739 Label done, slow; |
| 4740 | 4740 |
| 4741 // Generate code for loading from variables potentially shadowed | 4741 // Generate code for loading from variables potentially shadowed |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5076 __ Bind(&l_next); | 5076 __ Bind(&l_next); |
| 5077 | 5077 |
| 5078 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" | 5078 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" |
| 5079 __ Peek(x3, 1 * kPointerSize); // iter | 5079 __ Peek(x3, 1 * kPointerSize); // iter |
| 5080 __ Push(load_name, x3, x0); // "next", iter, received | 5080 __ Push(load_name, x3, x0); // "next", iter, received |
| 5081 | 5081 |
| 5082 // result = receiver[f](arg); | 5082 // result = receiver[f](arg); |
| 5083 __ Bind(&l_call); | 5083 __ Bind(&l_call); |
| 5084 __ Peek(load_receiver, 1 * kPointerSize); | 5084 __ Peek(load_receiver, 1 * kPointerSize); |
| 5085 __ Peek(load_name, 2 * kPointerSize); | 5085 __ Peek(load_name, 2 * kPointerSize); |
| 5086 __ Mov(VectorLoadICDescriptor::SlotRegister(), | 5086 __ Mov(LoadDescriptor::SlotRegister(), |
| 5087 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); | 5087 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); |
| 5088 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 5088 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
| 5089 CallIC(ic, TypeFeedbackId::None()); | 5089 CallIC(ic, TypeFeedbackId::None()); |
| 5090 __ Mov(x1, x0); | 5090 __ Mov(x1, x0); |
| 5091 __ Poke(x1, 2 * kPointerSize); | 5091 __ Poke(x1, 2 * kPointerSize); |
| 5092 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 5092 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
| 5093 __ CallStub(&stub); | 5093 __ CallStub(&stub); |
| 5094 | 5094 |
| 5095 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5095 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 5096 __ Drop(1); // The function is still on the stack; drop it. | 5096 __ Drop(1); // The function is still on the stack; drop it. |
| 5097 | 5097 |
| 5098 // if (!result.done) goto l_try; | 5098 // if (!result.done) goto l_try; |
| 5099 __ Bind(&l_loop); | 5099 __ Bind(&l_loop); |
| 5100 __ Move(load_receiver, x0); | 5100 __ Move(load_receiver, x0); |
| 5101 | 5101 |
| 5102 __ Push(load_receiver); // save result | 5102 __ Push(load_receiver); // save result |
| 5103 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" | 5103 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" |
| 5104 __ Mov(VectorLoadICDescriptor::SlotRegister(), | 5104 __ Mov(LoadDescriptor::SlotRegister(), |
| 5105 SmiFromSlot(expr->DoneFeedbackSlot())); | 5105 SmiFromSlot(expr->DoneFeedbackSlot())); |
| 5106 CallLoadIC(NOT_CONTEXTUAL); // x0=result.done | 5106 CallLoadIC(NOT_CONTEXTUAL); // x0=result.done |
| 5107 // The ToBooleanStub argument (result.done) is in x0. | 5107 // The ToBooleanStub argument (result.done) is in x0. |
| 5108 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 5108 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
| 5109 CallIC(bool_ic); | 5109 CallIC(bool_ic); |
| 5110 __ Cbz(x0, &l_try); | 5110 __ Cbz(x0, &l_try); |
| 5111 | 5111 |
| 5112 // result.value | 5112 // result.value |
| 5113 __ Pop(load_receiver); // result | 5113 __ Pop(load_receiver); // result |
| 5114 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" | 5114 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" |
| 5115 __ Mov(VectorLoadICDescriptor::SlotRegister(), | 5115 __ Mov(LoadDescriptor::SlotRegister(), |
| 5116 SmiFromSlot(expr->ValueFeedbackSlot())); | 5116 SmiFromSlot(expr->ValueFeedbackSlot())); |
| 5117 CallLoadIC(NOT_CONTEXTUAL); // x0=result.value | 5117 CallLoadIC(NOT_CONTEXTUAL); // x0=result.value |
| 5118 context()->DropAndPlug(2, x0); // drop iter and g | 5118 context()->DropAndPlug(2, x0); // drop iter and g |
| 5119 break; | 5119 break; |
| 5120 } | 5120 } |
| 5121 } | 5121 } |
| 5122 } | 5122 } |
| 5123 | 5123 |
| 5124 | 5124 |
| 5125 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 5125 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5453 } | 5453 } |
| 5454 } | 5454 } |
| 5455 | 5455 |
| 5456 return INTERRUPT; | 5456 return INTERRUPT; |
| 5457 } | 5457 } |
| 5458 | 5458 |
| 5459 | 5459 |
| 5460 } } // namespace v8::internal | 5460 } } // namespace v8::internal |
| 5461 | 5461 |
| 5462 #endif // V8_TARGET_ARCH_ARM64 | 5462 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |