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-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 | 1326 |
1327 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { | 1327 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { |
1328 Comment cnmt(masm_, "[ SuperReference "); | 1328 Comment cnmt(masm_, "[ SuperReference "); |
1329 | 1329 |
1330 __ ldr(LoadDescriptor::ReceiverRegister(), | 1330 __ ldr(LoadDescriptor::ReceiverRegister(), |
1331 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1331 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1332 | 1332 |
1333 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); | 1333 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); |
1334 __ Move(LoadDescriptor::NameRegister(), home_object_symbol); | 1334 __ Move(LoadDescriptor::NameRegister(), home_object_symbol); |
1335 | 1335 |
1336 if (FLAG_vector_ics) { | 1336 __ mov(VectorLoadICDescriptor::SlotRegister(), |
1337 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1337 Operand(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); |
1338 Operand(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); | 1338 CallLoadIC(NOT_CONTEXTUAL); |
1339 CallLoadIC(NOT_CONTEXTUAL); | |
1340 } else { | |
1341 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId()); | |
1342 } | |
1343 | 1339 |
1344 __ cmp(r0, Operand(isolate()->factory()->undefined_value())); | 1340 __ cmp(r0, Operand(isolate()->factory()->undefined_value())); |
1345 Label done; | 1341 Label done; |
1346 __ b(ne, &done); | 1342 __ b(ne, &done); |
1347 __ CallRuntime(Runtime::kThrowNonMethodError, 0); | 1343 __ CallRuntime(Runtime::kThrowNonMethodError, 0); |
1348 __ bind(&done); | 1344 __ bind(&done); |
1349 } | 1345 } |
1350 | 1346 |
1351 | 1347 |
1352 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer, | 1348 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 __ tst(temp, temp); | 1401 __ tst(temp, temp); |
1406 __ b(ne, slow); | 1402 __ b(ne, slow); |
1407 // Load next context in chain. | 1403 // Load next context in chain. |
1408 __ ldr(next, ContextOperand(next, Context::PREVIOUS_INDEX)); | 1404 __ ldr(next, ContextOperand(next, Context::PREVIOUS_INDEX)); |
1409 __ b(&loop); | 1405 __ b(&loop); |
1410 __ bind(&fast); | 1406 __ bind(&fast); |
1411 } | 1407 } |
1412 | 1408 |
1413 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1409 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1414 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->var()->name())); | 1410 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->var()->name())); |
1415 if (FLAG_vector_ics) { | 1411 __ mov(VectorLoadICDescriptor::SlotRegister(), |
1416 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1412 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1417 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | |
1418 } | |
1419 | 1413 |
1420 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) | 1414 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) |
1421 ? NOT_CONTEXTUAL | 1415 ? NOT_CONTEXTUAL |
1422 : CONTEXTUAL; | 1416 : CONTEXTUAL; |
1423 CallLoadIC(mode); | 1417 CallLoadIC(mode); |
1424 } | 1418 } |
1425 | 1419 |
1426 | 1420 |
1427 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1421 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
1428 Label* slow) { | 1422 Label* slow) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); | 1489 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); |
1496 Variable* var = proxy->var(); | 1490 Variable* var = proxy->var(); |
1497 | 1491 |
1498 // Three cases: global variables, lookup variables, and all other types of | 1492 // Three cases: global variables, lookup variables, and all other types of |
1499 // variables. | 1493 // variables. |
1500 switch (var->location()) { | 1494 switch (var->location()) { |
1501 case Variable::UNALLOCATED: { | 1495 case Variable::UNALLOCATED: { |
1502 Comment cmnt(masm_, "[ Global variable"); | 1496 Comment cmnt(masm_, "[ Global variable"); |
1503 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1497 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1504 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); | 1498 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); |
1505 if (FLAG_vector_ics) { | 1499 __ mov(VectorLoadICDescriptor::SlotRegister(), |
1506 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1500 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1507 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | |
1508 } | |
1509 CallGlobalLoadIC(var->name()); | 1501 CallGlobalLoadIC(var->name()); |
1510 context()->Plug(r0); | 1502 context()->Plug(r0); |
1511 break; | 1503 break; |
1512 } | 1504 } |
1513 | 1505 |
1514 case Variable::PARAMETER: | 1506 case Variable::PARAMETER: |
1515 case Variable::LOCAL: | 1507 case Variable::LOCAL: |
1516 case Variable::CONTEXT: { | 1508 case Variable::CONTEXT: { |
1517 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" | 1509 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" |
1518 : "[ Stack variable"); | 1510 : "[ Stack variable"); |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2193 __ bind(&l_next); | 2185 __ bind(&l_next); |
2194 | 2186 |
2195 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" | 2187 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" |
2196 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter | 2188 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter |
2197 __ Push(load_name, r3, r0); // "next", iter, received | 2189 __ Push(load_name, r3, r0); // "next", iter, received |
2198 | 2190 |
2199 // result = receiver[f](arg); | 2191 // result = receiver[f](arg); |
2200 __ bind(&l_call); | 2192 __ bind(&l_call); |
2201 __ ldr(load_receiver, MemOperand(sp, kPointerSize)); | 2193 __ ldr(load_receiver, MemOperand(sp, kPointerSize)); |
2202 __ ldr(load_name, MemOperand(sp, 2 * kPointerSize)); | 2194 __ ldr(load_name, MemOperand(sp, 2 * kPointerSize)); |
2203 if (FLAG_vector_ics) { | 2195 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2204 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2196 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2205 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | |
2206 } | |
2207 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2197 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
2208 CallIC(ic, TypeFeedbackId::None()); | 2198 CallIC(ic, TypeFeedbackId::None()); |
2209 __ mov(r1, r0); | 2199 __ mov(r1, r0); |
2210 __ str(r1, MemOperand(sp, 2 * kPointerSize)); | 2200 __ str(r1, MemOperand(sp, 2 * kPointerSize)); |
2211 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2201 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2212 __ CallStub(&stub); | 2202 __ CallStub(&stub); |
2213 | 2203 |
2214 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2204 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2215 __ Drop(1); // The function is still on the stack; drop it. | 2205 __ Drop(1); // The function is still on the stack; drop it. |
2216 | 2206 |
2217 // if (!result.done) goto l_try; | 2207 // if (!result.done) goto l_try; |
2218 __ bind(&l_loop); | 2208 __ bind(&l_loop); |
2219 __ Move(load_receiver, r0); | 2209 __ Move(load_receiver, r0); |
2220 | 2210 |
2221 __ push(load_receiver); // save result | 2211 __ push(load_receiver); // save result |
2222 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" | 2212 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" |
2223 if (FLAG_vector_ics) { | 2213 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2224 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2214 Operand(SmiFromSlot(expr->DoneFeedbackSlot()))); |
2225 Operand(SmiFromSlot(expr->DoneFeedbackSlot()))); | |
2226 } | |
2227 CallLoadIC(NOT_CONTEXTUAL); // r0=result.done | 2215 CallLoadIC(NOT_CONTEXTUAL); // r0=result.done |
2228 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2216 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
2229 CallIC(bool_ic); | 2217 CallIC(bool_ic); |
2230 __ cmp(r0, Operand(0)); | 2218 __ cmp(r0, Operand(0)); |
2231 __ b(eq, &l_try); | 2219 __ b(eq, &l_try); |
2232 | 2220 |
2233 // result.value | 2221 // result.value |
2234 __ pop(load_receiver); // result | 2222 __ pop(load_receiver); // result |
2235 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" | 2223 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" |
2236 if (FLAG_vector_ics) { | 2224 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2237 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2225 Operand(SmiFromSlot(expr->ValueFeedbackSlot()))); |
2238 Operand(SmiFromSlot(expr->ValueFeedbackSlot()))); | |
2239 } | |
2240 CallLoadIC(NOT_CONTEXTUAL); // r0=result.value | 2226 CallLoadIC(NOT_CONTEXTUAL); // r0=result.value |
2241 context()->DropAndPlug(2, r0); // drop iter and g | 2227 context()->DropAndPlug(2, r0); // drop iter and g |
2242 break; | 2228 break; |
2243 } | 2229 } |
2244 } | 2230 } |
2245 } | 2231 } |
2246 | 2232 |
2247 | 2233 |
2248 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 2234 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
2249 Expression *value, | 2235 Expression *value, |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2381 r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); | 2367 r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); |
2382 } | 2368 } |
2383 | 2369 |
2384 | 2370 |
2385 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2371 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2386 SetSourcePosition(prop->position()); | 2372 SetSourcePosition(prop->position()); |
2387 Literal* key = prop->key()->AsLiteral(); | 2373 Literal* key = prop->key()->AsLiteral(); |
2388 DCHECK(!prop->IsSuperAccess()); | 2374 DCHECK(!prop->IsSuperAccess()); |
2389 | 2375 |
2390 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); | 2376 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); |
2391 if (FLAG_vector_ics) { | 2377 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2392 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2378 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2393 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2379 CallLoadIC(NOT_CONTEXTUAL); |
2394 CallLoadIC(NOT_CONTEXTUAL); | |
2395 } else { | |
2396 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | |
2397 } | |
2398 } | 2380 } |
2399 | 2381 |
2400 | 2382 |
2401 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2383 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
2402 // Stack: receiver, home_object. | 2384 // Stack: receiver, home_object. |
2403 SetSourcePosition(prop->position()); | 2385 SetSourcePosition(prop->position()); |
2404 Literal* key = prop->key()->AsLiteral(); | 2386 Literal* key = prop->key()->AsLiteral(); |
2405 DCHECK(!key->value()->IsSmi()); | 2387 DCHECK(!key->value()->IsSmi()); |
2406 DCHECK(prop->IsSuperAccess()); | 2388 DCHECK(prop->IsSuperAccess()); |
2407 | 2389 |
2408 __ Push(key->value()); | 2390 __ Push(key->value()); |
2409 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2391 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
2410 } | 2392 } |
2411 | 2393 |
2412 | 2394 |
2413 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2395 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2414 SetSourcePosition(prop->position()); | 2396 SetSourcePosition(prop->position()); |
2415 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2397 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
2416 if (FLAG_vector_ics) { | 2398 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2417 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2399 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2418 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2400 CallIC(ic); |
2419 CallIC(ic); | |
2420 } else { | |
2421 CallIC(ic, prop->PropertyFeedbackId()); | |
2422 } | |
2423 } | 2401 } |
2424 | 2402 |
2425 | 2403 |
2426 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2404 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2427 // Stack: receiver, home_object, key. | 2405 // Stack: receiver, home_object, key. |
2428 SetSourcePosition(prop->position()); | 2406 SetSourcePosition(prop->position()); |
2429 | 2407 |
2430 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2408 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
2431 } | 2409 } |
2432 | 2410 |
(...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4624 | 4602 |
4625 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4603 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
4626 // Push the builtins object as the receiver. | 4604 // Push the builtins object as the receiver. |
4627 Register receiver = LoadDescriptor::ReceiverRegister(); | 4605 Register receiver = LoadDescriptor::ReceiverRegister(); |
4628 __ ldr(receiver, GlobalObjectOperand()); | 4606 __ ldr(receiver, GlobalObjectOperand()); |
4629 __ ldr(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); | 4607 __ ldr(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); |
4630 __ push(receiver); | 4608 __ push(receiver); |
4631 | 4609 |
4632 // Load the function from the receiver. | 4610 // Load the function from the receiver. |
4633 __ mov(LoadDescriptor::NameRegister(), Operand(expr->name())); | 4611 __ mov(LoadDescriptor::NameRegister(), Operand(expr->name())); |
4634 if (FLAG_vector_ics) { | 4612 __ mov(VectorLoadICDescriptor::SlotRegister(), |
4635 __ mov(VectorLoadICDescriptor::SlotRegister(), | 4613 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
4636 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4614 CallLoadIC(NOT_CONTEXTUAL); |
4637 CallLoadIC(NOT_CONTEXTUAL); | |
4638 } else { | |
4639 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | |
4640 } | |
4641 } | 4615 } |
4642 | 4616 |
4643 | 4617 |
4644 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4618 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4645 ZoneList<Expression*>* args = expr->arguments(); | 4619 ZoneList<Expression*>* args = expr->arguments(); |
4646 int arg_count = args->length(); | 4620 int arg_count = args->length(); |
4647 | 4621 |
4648 // Record source position of the IC call. | 4622 // Record source position of the IC call. |
4649 SetSourcePosition(expr->position()); | 4623 SetSourcePosition(expr->position()); |
4650 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4624 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5063 | 5037 |
5064 | 5038 |
5065 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { | 5039 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
5066 DCHECK(!context()->IsEffect()); | 5040 DCHECK(!context()->IsEffect()); |
5067 DCHECK(!context()->IsTest()); | 5041 DCHECK(!context()->IsTest()); |
5068 VariableProxy* proxy = expr->AsVariableProxy(); | 5042 VariableProxy* proxy = expr->AsVariableProxy(); |
5069 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 5043 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
5070 Comment cmnt(masm_, "[ Global variable"); | 5044 Comment cmnt(masm_, "[ Global variable"); |
5071 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 5045 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
5072 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->name())); | 5046 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->name())); |
5073 if (FLAG_vector_ics) { | 5047 __ mov(VectorLoadICDescriptor::SlotRegister(), |
5074 __ mov(VectorLoadICDescriptor::SlotRegister(), | 5048 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
5075 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | |
5076 } | |
5077 // Use a regular load, not a contextual load, to avoid a reference | 5049 // Use a regular load, not a contextual load, to avoid a reference |
5078 // error. | 5050 // error. |
5079 CallLoadIC(NOT_CONTEXTUAL); | 5051 CallLoadIC(NOT_CONTEXTUAL); |
5080 PrepareForBailout(expr, TOS_REG); | 5052 PrepareForBailout(expr, TOS_REG); |
5081 context()->Plug(r0); | 5053 context()->Plug(r0); |
5082 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 5054 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
5083 Comment cmnt(masm_, "[ Lookup slot"); | 5055 Comment cmnt(masm_, "[ Lookup slot"); |
5084 Label done, slow; | 5056 Label done, slow; |
5085 | 5057 |
5086 // Generate code for loading from variables potentially shadowed | 5058 // Generate code for loading from variables potentially shadowed |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5510 | 5482 |
5511 DCHECK(interrupt_address == | 5483 DCHECK(interrupt_address == |
5512 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5484 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5513 return OSR_AFTER_STACK_CHECK; | 5485 return OSR_AFTER_STACK_CHECK; |
5514 } | 5486 } |
5515 | 5487 |
5516 | 5488 |
5517 } } // namespace v8::internal | 5489 } } // namespace v8::internal |
5518 | 5490 |
5519 #endif // V8_TARGET_ARCH_ARM | 5491 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |