| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 7 #if V8_TARGET_ARCH_ARM |
| 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 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 __ bind(&fast); | 1403 __ bind(&fast); |
| 1404 } | 1404 } |
| 1405 | 1405 |
| 1406 __ ldr(LoadIC::ReceiverRegister(), GlobalObjectOperand()); | 1406 __ ldr(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
| 1407 __ mov(LoadIC::NameRegister(), Operand(proxy->var()->name())); | 1407 __ mov(LoadIC::NameRegister(), Operand(proxy->var()->name())); |
| 1408 if (FLAG_vector_ics) { | 1408 if (FLAG_vector_ics) { |
| 1409 __ mov(LoadIC::SlotRegister(), | 1409 __ mov(LoadIC::SlotRegister(), |
| 1410 Operand(Smi::FromInt(proxy->VariableFeedbackSlot()))); | 1410 Operand(Smi::FromInt(proxy->VariableFeedbackSlot()))); |
| 1411 } | 1411 } |
| 1412 | 1412 |
| 1413 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) | 1413 CallLoadIC(typeof_state); |
| 1414 ? NOT_CONTEXTUAL | |
| 1415 : CONTEXTUAL; | |
| 1416 CallLoadIC(mode); | |
| 1417 } | 1414 } |
| 1418 | 1415 |
| 1419 | 1416 |
| 1420 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1417 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
| 1421 Label* slow) { | 1418 Label* slow) { |
| 1422 ASSERT(var->IsContextSlot()); | 1419 ASSERT(var->IsContextSlot()); |
| 1423 Register context = cp; | 1420 Register context = cp; |
| 1424 Register next = r3; | 1421 Register next = r3; |
| 1425 Register temp = r4; | 1422 Register temp = r4; |
| 1426 | 1423 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 // variables. | 1488 // variables. |
| 1492 switch (var->location()) { | 1489 switch (var->location()) { |
| 1493 case Variable::UNALLOCATED: { | 1490 case Variable::UNALLOCATED: { |
| 1494 Comment cmnt(masm_, "[ Global variable"); | 1491 Comment cmnt(masm_, "[ Global variable"); |
| 1495 __ ldr(LoadIC::ReceiverRegister(), GlobalObjectOperand()); | 1492 __ ldr(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
| 1496 __ mov(LoadIC::NameRegister(), Operand(var->name())); | 1493 __ mov(LoadIC::NameRegister(), Operand(var->name())); |
| 1497 if (FLAG_vector_ics) { | 1494 if (FLAG_vector_ics) { |
| 1498 __ mov(LoadIC::SlotRegister(), | 1495 __ mov(LoadIC::SlotRegister(), |
| 1499 Operand(Smi::FromInt(proxy->VariableFeedbackSlot()))); | 1496 Operand(Smi::FromInt(proxy->VariableFeedbackSlot()))); |
| 1500 } | 1497 } |
| 1501 CallLoadIC(CONTEXTUAL); | 1498 CallLoadIC(NOT_INSIDE_TYPEOF); |
| 1502 context()->Plug(r0); | 1499 context()->Plug(r0); |
| 1503 break; | 1500 break; |
| 1504 } | 1501 } |
| 1505 | 1502 |
| 1506 case Variable::PARAMETER: | 1503 case Variable::PARAMETER: |
| 1507 case Variable::LOCAL: | 1504 case Variable::LOCAL: |
| 1508 case Variable::CONTEXT: { | 1505 case Variable::CONTEXT: { |
| 1509 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" | 1506 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" |
| 1510 : "[ Stack variable"); | 1507 : "[ Stack variable"); |
| 1511 if (var->binding_needs_init()) { | 1508 if (var->binding_needs_init()) { |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 // if (!result.done) goto l_try; | 2102 // if (!result.done) goto l_try; |
| 2106 __ bind(&l_loop); | 2103 __ bind(&l_loop); |
| 2107 __ Move(load_receiver, r0); | 2104 __ Move(load_receiver, r0); |
| 2108 | 2105 |
| 2109 __ push(load_receiver); // save result | 2106 __ push(load_receiver); // save result |
| 2110 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" | 2107 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" |
| 2111 if (FLAG_vector_ics) { | 2108 if (FLAG_vector_ics) { |
| 2112 __ mov(LoadIC::SlotRegister(), | 2109 __ mov(LoadIC::SlotRegister(), |
| 2113 Operand(Smi::FromInt(expr->DoneFeedbackSlot()))); | 2110 Operand(Smi::FromInt(expr->DoneFeedbackSlot()))); |
| 2114 } | 2111 } |
| 2115 CallLoadIC(NOT_CONTEXTUAL); // r0=result.done | 2112 CallLoadIC(); // r0=result.done |
| 2116 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2113 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
| 2117 CallIC(bool_ic); | 2114 CallIC(bool_ic); |
| 2118 __ cmp(r0, Operand(0)); | 2115 __ cmp(r0, Operand(0)); |
| 2119 __ b(eq, &l_try); | 2116 __ b(eq, &l_try); |
| 2120 | 2117 |
| 2121 // result.value | 2118 // result.value |
| 2122 __ pop(load_receiver); // result | 2119 __ pop(load_receiver); // result |
| 2123 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" | 2120 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" |
| 2124 if (FLAG_vector_ics) { | 2121 if (FLAG_vector_ics) { |
| 2125 __ mov(LoadIC::SlotRegister(), | 2122 __ mov(LoadIC::SlotRegister(), |
| 2126 Operand(Smi::FromInt(expr->ValueFeedbackSlot()))); | 2123 Operand(Smi::FromInt(expr->ValueFeedbackSlot()))); |
| 2127 } | 2124 } |
| 2128 CallLoadIC(NOT_CONTEXTUAL); // r0=result.value | 2125 CallLoadIC(); // r0=result.value |
| 2129 context()->DropAndPlug(2, r0); // drop iter and g | 2126 context()->DropAndPlug(2, r0); // drop iter and g |
| 2130 break; | 2127 break; |
| 2131 } | 2128 } |
| 2132 } | 2129 } |
| 2133 } | 2130 } |
| 2134 | 2131 |
| 2135 | 2132 |
| 2136 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 2133 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
| 2137 Expression *value, | 2134 Expression *value, |
| 2138 JSGeneratorObject::ResumeMode resume_mode) { | 2135 JSGeneratorObject::ResumeMode resume_mode) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2296 } | 2293 } |
| 2297 | 2294 |
| 2298 | 2295 |
| 2299 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2296 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 2300 SetSourcePosition(prop->position()); | 2297 SetSourcePosition(prop->position()); |
| 2301 Literal* key = prop->key()->AsLiteral(); | 2298 Literal* key = prop->key()->AsLiteral(); |
| 2302 __ mov(LoadIC::NameRegister(), Operand(key->value())); | 2299 __ mov(LoadIC::NameRegister(), Operand(key->value())); |
| 2303 if (FLAG_vector_ics) { | 2300 if (FLAG_vector_ics) { |
| 2304 __ mov(LoadIC::SlotRegister(), | 2301 __ mov(LoadIC::SlotRegister(), |
| 2305 Operand(Smi::FromInt(prop->PropertyFeedbackSlot()))); | 2302 Operand(Smi::FromInt(prop->PropertyFeedbackSlot()))); |
| 2306 CallLoadIC(NOT_CONTEXTUAL); | 2303 CallLoadIC(INSIDE_TYPEOF); |
| 2307 } else { | 2304 } else { |
| 2308 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 2305 CallLoadIC(INSIDE_TYPEOF, prop->PropertyFeedbackId()); |
| 2309 } | 2306 } |
| 2310 } | 2307 } |
| 2311 | 2308 |
| 2312 | 2309 |
| 2313 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2310 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2314 SetSourcePosition(prop->position()); | 2311 SetSourcePosition(prop->position()); |
| 2315 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 2312 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
| 2316 if (FLAG_vector_ics) { | 2313 if (FLAG_vector_ics) { |
| 2317 __ mov(LoadIC::SlotRegister(), | 2314 __ mov(LoadIC::SlotRegister(), |
| 2318 Operand(Smi::FromInt(prop->PropertyFeedbackSlot()))); | 2315 Operand(Smi::FromInt(prop->PropertyFeedbackSlot()))); |
| (...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4084 Register receiver = LoadIC::ReceiverRegister(); | 4081 Register receiver = LoadIC::ReceiverRegister(); |
| 4085 __ ldr(receiver, GlobalObjectOperand()); | 4082 __ ldr(receiver, GlobalObjectOperand()); |
| 4086 __ ldr(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); | 4083 __ ldr(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); |
| 4087 __ push(receiver); | 4084 __ push(receiver); |
| 4088 | 4085 |
| 4089 // Load the function from the receiver. | 4086 // Load the function from the receiver. |
| 4090 __ mov(LoadIC::NameRegister(), Operand(expr->name())); | 4087 __ mov(LoadIC::NameRegister(), Operand(expr->name())); |
| 4091 if (FLAG_vector_ics) { | 4088 if (FLAG_vector_ics) { |
| 4092 __ mov(LoadIC::SlotRegister(), | 4089 __ mov(LoadIC::SlotRegister(), |
| 4093 Operand(Smi::FromInt(expr->CallRuntimeFeedbackSlot()))); | 4090 Operand(Smi::FromInt(expr->CallRuntimeFeedbackSlot()))); |
| 4094 CallLoadIC(NOT_CONTEXTUAL); | 4091 CallLoadIC(INSIDE_TYPEOF); |
| 4095 } else { | 4092 } else { |
| 4096 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | 4093 CallLoadIC(INSIDE_TYPEOF, expr->CallRuntimeFeedbackId()); |
| 4097 } | 4094 } |
| 4098 | 4095 |
| 4099 // Push the target function under the receiver. | 4096 // Push the target function under the receiver. |
| 4100 __ ldr(ip, MemOperand(sp, 0)); | 4097 __ ldr(ip, MemOperand(sp, 0)); |
| 4101 __ push(ip); | 4098 __ push(ip); |
| 4102 __ str(r0, MemOperand(sp, kPointerSize)); | 4099 __ str(r0, MemOperand(sp, kPointerSize)); |
| 4103 | 4100 |
| 4104 // Push the arguments ("left-to-right"). | 4101 // Push the arguments ("left-to-right"). |
| 4105 int arg_count = args->length(); | 4102 int arg_count = args->length(); |
| 4106 for (int i = 0; i < arg_count; i++) { | 4103 for (int i = 0; i < arg_count; i++) { |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4425 ASSERT(!context()->IsTest()); | 4422 ASSERT(!context()->IsTest()); |
| 4426 VariableProxy* proxy = expr->AsVariableProxy(); | 4423 VariableProxy* proxy = expr->AsVariableProxy(); |
| 4427 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 4424 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
| 4428 Comment cmnt(masm_, "[ Global variable"); | 4425 Comment cmnt(masm_, "[ Global variable"); |
| 4429 __ ldr(LoadIC::ReceiverRegister(), GlobalObjectOperand()); | 4426 __ ldr(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
| 4430 __ mov(LoadIC::NameRegister(), Operand(proxy->name())); | 4427 __ mov(LoadIC::NameRegister(), Operand(proxy->name())); |
| 4431 if (FLAG_vector_ics) { | 4428 if (FLAG_vector_ics) { |
| 4432 __ mov(LoadIC::SlotRegister(), | 4429 __ mov(LoadIC::SlotRegister(), |
| 4433 Operand(Smi::FromInt(proxy->VariableFeedbackSlot()))); | 4430 Operand(Smi::FromInt(proxy->VariableFeedbackSlot()))); |
| 4434 } | 4431 } |
| 4435 // Use a regular load, not a contextual load, to avoid a reference | 4432 // We don't want a reference error if the load fails on the global object. |
| 4436 // error. | 4433 CallLoadIC(); |
| 4437 CallLoadIC(NOT_CONTEXTUAL); | |
| 4438 PrepareForBailout(expr, TOS_REG); | 4434 PrepareForBailout(expr, TOS_REG); |
| 4439 context()->Plug(r0); | 4435 context()->Plug(r0); |
| 4440 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 4436 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
| 4441 Comment cmnt(masm_, "[ Lookup slot"); | 4437 Comment cmnt(masm_, "[ Lookup slot"); |
| 4442 Label done, slow; | 4438 Label done, slow; |
| 4443 | 4439 |
| 4444 // Generate code for loading from variables potentially shadowed | 4440 // Generate code for loading from variables potentially shadowed |
| 4445 // by eval-introduced variables. | 4441 // by eval-introduced variables. |
| 4446 EmitDynamicLookupFastCase(proxy, INSIDE_TYPEOF, &slow, &done); | 4442 EmitDynamicLookupFastCase(proxy, INSIDE_TYPEOF, &slow, &done); |
| 4447 | 4443 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4890 | 4886 |
| 4891 ASSERT(interrupt_address == | 4887 ASSERT(interrupt_address == |
| 4892 isolate->builtins()->OsrAfterStackCheck()->entry()); | 4888 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 4893 return OSR_AFTER_STACK_CHECK; | 4889 return OSR_AFTER_STACK_CHECK; |
| 4894 } | 4890 } |
| 4895 | 4891 |
| 4896 | 4892 |
| 4897 } } // namespace v8::internal | 4893 } } // namespace v8::internal |
| 4898 | 4894 |
| 4899 #endif // V8_TARGET_ARCH_ARM | 4895 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |