| 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-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 __ Bind(&fast); | 1394 __ Bind(&fast); |
| 1395 } | 1395 } |
| 1396 | 1396 |
| 1397 __ Ldr(LoadIC::ReceiverRegister(), GlobalObjectMemOperand()); | 1397 __ Ldr(LoadIC::ReceiverRegister(), GlobalObjectMemOperand()); |
| 1398 __ Mov(LoadIC::NameRegister(), Operand(proxy->var()->name())); | 1398 __ Mov(LoadIC::NameRegister(), Operand(proxy->var()->name())); |
| 1399 if (FLAG_vector_ics) { | 1399 if (FLAG_vector_ics) { |
| 1400 __ Mov(LoadIC::SlotRegister(), | 1400 __ Mov(LoadIC::SlotRegister(), |
| 1401 Smi::FromInt(proxy->VariableFeedbackSlot())); | 1401 Smi::FromInt(proxy->VariableFeedbackSlot())); |
| 1402 } | 1402 } |
| 1403 | 1403 |
| 1404 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) ? NOT_CONTEXTUAL | 1404 CallLoadIC(typeof_state); |
| 1405 : CONTEXTUAL; | |
| 1406 CallLoadIC(mode); | |
| 1407 } | 1405 } |
| 1408 | 1406 |
| 1409 | 1407 |
| 1410 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1408 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
| 1411 Label* slow) { | 1409 Label* slow) { |
| 1412 ASSERT(var->IsContextSlot()); | 1410 ASSERT(var->IsContextSlot()); |
| 1413 Register context = cp; | 1411 Register context = cp; |
| 1414 Register next = x10; | 1412 Register next = x10; |
| 1415 Register temp = x11; | 1413 Register temp = x11; |
| 1416 | 1414 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 // variables. | 1476 // variables. |
| 1479 switch (var->location()) { | 1477 switch (var->location()) { |
| 1480 case Variable::UNALLOCATED: { | 1478 case Variable::UNALLOCATED: { |
| 1481 Comment cmnt(masm_, "Global variable"); | 1479 Comment cmnt(masm_, "Global variable"); |
| 1482 __ Ldr(LoadIC::ReceiverRegister(), GlobalObjectMemOperand()); | 1480 __ Ldr(LoadIC::ReceiverRegister(), GlobalObjectMemOperand()); |
| 1483 __ Mov(LoadIC::NameRegister(), Operand(var->name())); | 1481 __ Mov(LoadIC::NameRegister(), Operand(var->name())); |
| 1484 if (FLAG_vector_ics) { | 1482 if (FLAG_vector_ics) { |
| 1485 __ Mov(LoadIC::SlotRegister(), | 1483 __ Mov(LoadIC::SlotRegister(), |
| 1486 Smi::FromInt(proxy->VariableFeedbackSlot())); | 1484 Smi::FromInt(proxy->VariableFeedbackSlot())); |
| 1487 } | 1485 } |
| 1488 CallLoadIC(CONTEXTUAL); | 1486 CallLoadIC(NOT_INSIDE_TYPEOF); |
| 1489 context()->Plug(x0); | 1487 context()->Plug(x0); |
| 1490 break; | 1488 break; |
| 1491 } | 1489 } |
| 1492 | 1490 |
| 1493 case Variable::PARAMETER: | 1491 case Variable::PARAMETER: |
| 1494 case Variable::LOCAL: | 1492 case Variable::LOCAL: |
| 1495 case Variable::CONTEXT: { | 1493 case Variable::CONTEXT: { |
| 1496 Comment cmnt(masm_, var->IsContextSlot() | 1494 Comment cmnt(masm_, var->IsContextSlot() |
| 1497 ? "Context variable" | 1495 ? "Context variable" |
| 1498 : "Stack variable"); | 1496 : "Stack variable"); |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1956 } | 1954 } |
| 1957 | 1955 |
| 1958 | 1956 |
| 1959 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 1957 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 1960 SetSourcePosition(prop->position()); | 1958 SetSourcePosition(prop->position()); |
| 1961 Literal* key = prop->key()->AsLiteral(); | 1959 Literal* key = prop->key()->AsLiteral(); |
| 1962 __ Mov(LoadIC::NameRegister(), Operand(key->value())); | 1960 __ Mov(LoadIC::NameRegister(), Operand(key->value())); |
| 1963 if (FLAG_vector_ics) { | 1961 if (FLAG_vector_ics) { |
| 1964 __ Mov(LoadIC::SlotRegister(), | 1962 __ Mov(LoadIC::SlotRegister(), |
| 1965 Smi::FromInt(prop->PropertyFeedbackSlot())); | 1963 Smi::FromInt(prop->PropertyFeedbackSlot())); |
| 1966 CallLoadIC(NOT_CONTEXTUAL); | 1964 CallLoadIC(INSIDE_TYPEOF); |
| 1967 } else { | 1965 } else { |
| 1968 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 1966 CallLoadIC(INSIDE_TYPEOF, prop->PropertyFeedbackId()); |
| 1969 } | 1967 } |
| 1970 } | 1968 } |
| 1971 | 1969 |
| 1972 | 1970 |
| 1973 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 1971 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 1974 SetSourcePosition(prop->position()); | 1972 SetSourcePosition(prop->position()); |
| 1975 // Call keyed load IC. It has arguments key and receiver in r0 and r1. | 1973 // Call keyed load IC. It has arguments key and receiver in r0 and r1. |
| 1976 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 1974 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
| 1977 if (FLAG_vector_ics) { | 1975 if (FLAG_vector_ics) { |
| 1978 __ Mov(LoadIC::SlotRegister(), | 1976 __ Mov(LoadIC::SlotRegister(), |
| (...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3762 __ Ldr(LoadIC::ReceiverRegister(), | 3760 __ Ldr(LoadIC::ReceiverRegister(), |
| 3763 FieldMemOperand(x10, GlobalObject::kBuiltinsOffset)); | 3761 FieldMemOperand(x10, GlobalObject::kBuiltinsOffset)); |
| 3764 __ Push(LoadIC::ReceiverRegister()); | 3762 __ Push(LoadIC::ReceiverRegister()); |
| 3765 | 3763 |
| 3766 // Load the function from the receiver. | 3764 // Load the function from the receiver. |
| 3767 Handle<String> name = expr->name(); | 3765 Handle<String> name = expr->name(); |
| 3768 __ Mov(LoadIC::NameRegister(), Operand(name)); | 3766 __ Mov(LoadIC::NameRegister(), Operand(name)); |
| 3769 if (FLAG_vector_ics) { | 3767 if (FLAG_vector_ics) { |
| 3770 __ Mov(LoadIC::SlotRegister(), | 3768 __ Mov(LoadIC::SlotRegister(), |
| 3771 Smi::FromInt(expr->CallRuntimeFeedbackSlot())); | 3769 Smi::FromInt(expr->CallRuntimeFeedbackSlot())); |
| 3772 CallLoadIC(NOT_CONTEXTUAL); | 3770 CallLoadIC(INSIDE_TYPEOF); |
| 3773 } else { | 3771 } else { |
| 3774 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | 3772 CallLoadIC(INSIDE_TYPEOF, expr->CallRuntimeFeedbackId()); |
| 3775 } | 3773 } |
| 3776 | 3774 |
| 3777 // Push the target function under the receiver. | 3775 // Push the target function under the receiver. |
| 3778 __ Pop(x10); | 3776 __ Pop(x10); |
| 3779 __ Push(x0, x10); | 3777 __ Push(x0, x10); |
| 3780 | 3778 |
| 3781 int arg_count = args->length(); | 3779 int arg_count = args->length(); |
| 3782 for (int i = 0; i < arg_count; i++) { | 3780 for (int i = 0; i < arg_count; i++) { |
| 3783 VisitForStackValue(args->at(i)); | 3781 VisitForStackValue(args->at(i)); |
| 3784 } | 3782 } |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4104 ASSERT(!context()->IsTest()); | 4102 ASSERT(!context()->IsTest()); |
| 4105 VariableProxy* proxy = expr->AsVariableProxy(); | 4103 VariableProxy* proxy = expr->AsVariableProxy(); |
| 4106 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 4104 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
| 4107 Comment cmnt(masm_, "Global variable"); | 4105 Comment cmnt(masm_, "Global variable"); |
| 4108 __ Ldr(LoadIC::ReceiverRegister(), GlobalObjectMemOperand()); | 4106 __ Ldr(LoadIC::ReceiverRegister(), GlobalObjectMemOperand()); |
| 4109 __ Mov(LoadIC::NameRegister(), Operand(proxy->name())); | 4107 __ Mov(LoadIC::NameRegister(), Operand(proxy->name())); |
| 4110 if (FLAG_vector_ics) { | 4108 if (FLAG_vector_ics) { |
| 4111 __ Mov(LoadIC::SlotRegister(), | 4109 __ Mov(LoadIC::SlotRegister(), |
| 4112 Smi::FromInt(proxy->VariableFeedbackSlot())); | 4110 Smi::FromInt(proxy->VariableFeedbackSlot())); |
| 4113 } | 4111 } |
| 4114 // Use a regular load, not a contextual load, to avoid a reference | 4112 // We don't want a reference error if the load fails on the global object. |
| 4115 // error. | 4113 CallLoadIC(); |
| 4116 CallLoadIC(NOT_CONTEXTUAL); | |
| 4117 PrepareForBailout(expr, TOS_REG); | 4114 PrepareForBailout(expr, TOS_REG); |
| 4118 context()->Plug(x0); | 4115 context()->Plug(x0); |
| 4119 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 4116 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
| 4120 Label done, slow; | 4117 Label done, slow; |
| 4121 | 4118 |
| 4122 // Generate code for loading from variables potentially shadowed | 4119 // Generate code for loading from variables potentially shadowed |
| 4123 // by eval-introduced variables. | 4120 // by eval-introduced variables. |
| 4124 EmitDynamicLookupFastCase(proxy, INSIDE_TYPEOF, &slow, &done); | 4121 EmitDynamicLookupFastCase(proxy, INSIDE_TYPEOF, &slow, &done); |
| 4125 | 4122 |
| 4126 __ Bind(&slow); | 4123 __ Bind(&slow); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4480 // if (!result.done) goto l_try; | 4477 // if (!result.done) goto l_try; |
| 4481 __ Bind(&l_loop); | 4478 __ Bind(&l_loop); |
| 4482 __ Move(load_receiver, x0); | 4479 __ Move(load_receiver, x0); |
| 4483 | 4480 |
| 4484 __ Push(load_receiver); // save result | 4481 __ Push(load_receiver); // save result |
| 4485 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" | 4482 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" |
| 4486 if (FLAG_vector_ics) { | 4483 if (FLAG_vector_ics) { |
| 4487 __ Mov(LoadIC::SlotRegister(), | 4484 __ Mov(LoadIC::SlotRegister(), |
| 4488 Smi::FromInt(expr->DoneFeedbackSlot())); | 4485 Smi::FromInt(expr->DoneFeedbackSlot())); |
| 4489 } | 4486 } |
| 4490 CallLoadIC(NOT_CONTEXTUAL); // x0=result.done | 4487 CallLoadIC(); // x0=result.done |
| 4491 // The ToBooleanStub argument (result.done) is in x0. | 4488 // The ToBooleanStub argument (result.done) is in x0. |
| 4492 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 4489 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
| 4493 CallIC(bool_ic); | 4490 CallIC(bool_ic); |
| 4494 __ Cbz(x0, &l_try); | 4491 __ Cbz(x0, &l_try); |
| 4495 | 4492 |
| 4496 // result.value | 4493 // result.value |
| 4497 __ Pop(load_receiver); // result | 4494 __ Pop(load_receiver); // result |
| 4498 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" | 4495 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" |
| 4499 if (FLAG_vector_ics) { | 4496 if (FLAG_vector_ics) { |
| 4500 __ Mov(LoadIC::SlotRegister(), | 4497 __ Mov(LoadIC::SlotRegister(), |
| 4501 Smi::FromInt(expr->ValueFeedbackSlot())); | 4498 Smi::FromInt(expr->ValueFeedbackSlot())); |
| 4502 } | 4499 } |
| 4503 CallLoadIC(NOT_CONTEXTUAL); // x0=result.value | 4500 CallLoadIC(); // x0=result.value |
| 4504 context()->DropAndPlug(2, x0); // drop iter and g | 4501 context()->DropAndPlug(2, x0); // drop iter and g |
| 4505 break; | 4502 break; |
| 4506 } | 4503 } |
| 4507 } | 4504 } |
| 4508 } | 4505 } |
| 4509 | 4506 |
| 4510 | 4507 |
| 4511 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 4508 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
| 4512 Expression *value, | 4509 Expression *value, |
| 4513 JSGeneratorObject::ResumeMode resume_mode) { | 4510 JSGeneratorObject::ResumeMode resume_mode) { |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4922 return previous_; | 4919 return previous_; |
| 4923 } | 4920 } |
| 4924 | 4921 |
| 4925 | 4922 |
| 4926 #undef __ | 4923 #undef __ |
| 4927 | 4924 |
| 4928 | 4925 |
| 4929 } } // namespace v8::internal | 4926 } } // namespace v8::internal |
| 4930 | 4927 |
| 4931 #endif // V8_TARGET_ARCH_ARM64 | 4928 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |