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 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 | 1327 |
1328 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { | 1328 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { |
1329 Comment cnmt(masm_, "[ SuperReference "); | 1329 Comment cnmt(masm_, "[ SuperReference "); |
1330 | 1330 |
1331 __ ldr(LoadDescriptor::ReceiverRegister(), | 1331 __ ldr(LoadDescriptor::ReceiverRegister(), |
1332 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1332 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1333 | 1333 |
1334 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); | 1334 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); |
1335 __ Move(LoadDescriptor::NameRegister(), home_object_symbol); | 1335 __ Move(LoadDescriptor::NameRegister(), home_object_symbol); |
1336 | 1336 |
1337 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1337 __ mov(LoadDescriptor::SlotRegister(), |
1338 Operand(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); | 1338 Operand(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); |
1339 CallLoadIC(NOT_CONTEXTUAL); | 1339 CallLoadIC(NOT_CONTEXTUAL); |
1340 | 1340 |
1341 __ cmp(r0, Operand(isolate()->factory()->undefined_value())); | 1341 __ cmp(r0, Operand(isolate()->factory()->undefined_value())); |
1342 Label done; | 1342 Label done; |
1343 __ b(ne, &done); | 1343 __ b(ne, &done); |
1344 __ CallRuntime(Runtime::kThrowNonMethodError, 0); | 1344 __ CallRuntime(Runtime::kThrowNonMethodError, 0); |
1345 __ bind(&done); | 1345 __ bind(&done); |
1346 } | 1346 } |
1347 | 1347 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 __ tst(temp, temp); | 1402 __ tst(temp, temp); |
1403 __ b(ne, slow); | 1403 __ b(ne, slow); |
1404 // Load next context in chain. | 1404 // Load next context in chain. |
1405 __ ldr(next, ContextOperand(next, Context::PREVIOUS_INDEX)); | 1405 __ ldr(next, ContextOperand(next, Context::PREVIOUS_INDEX)); |
1406 __ b(&loop); | 1406 __ b(&loop); |
1407 __ bind(&fast); | 1407 __ bind(&fast); |
1408 } | 1408 } |
1409 | 1409 |
1410 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1410 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1411 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->var()->name())); | 1411 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->var()->name())); |
1412 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1412 __ mov(LoadDescriptor::SlotRegister(), |
1413 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1413 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1414 | 1414 |
1415 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) | 1415 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) |
1416 ? NOT_CONTEXTUAL | 1416 ? NOT_CONTEXTUAL |
1417 : CONTEXTUAL; | 1417 : CONTEXTUAL; |
1418 CallLoadIC(mode); | 1418 CallLoadIC(mode); |
1419 } | 1419 } |
1420 | 1420 |
1421 | 1421 |
1422 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1422 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); | 1490 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); |
1491 Variable* var = proxy->var(); | 1491 Variable* var = proxy->var(); |
1492 | 1492 |
1493 // Three cases: global variables, lookup variables, and all other types of | 1493 // Three cases: global variables, lookup variables, and all other types of |
1494 // variables. | 1494 // variables. |
1495 switch (var->location()) { | 1495 switch (var->location()) { |
1496 case Variable::UNALLOCATED: { | 1496 case Variable::UNALLOCATED: { |
1497 Comment cmnt(masm_, "[ Global variable"); | 1497 Comment cmnt(masm_, "[ Global variable"); |
1498 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1498 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1499 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); | 1499 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); |
1500 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1500 __ mov(LoadDescriptor::SlotRegister(), |
1501 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1501 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1502 CallGlobalLoadIC(var->name()); | 1502 CallGlobalLoadIC(var->name()); |
1503 context()->Plug(r0); | 1503 context()->Plug(r0); |
1504 break; | 1504 break; |
1505 } | 1505 } |
1506 | 1506 |
1507 case Variable::PARAMETER: | 1507 case Variable::PARAMETER: |
1508 case Variable::LOCAL: | 1508 case Variable::LOCAL: |
1509 case Variable::CONTEXT: { | 1509 case Variable::CONTEXT: { |
1510 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" | 1510 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2186 __ bind(&l_next); | 2186 __ bind(&l_next); |
2187 | 2187 |
2188 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" | 2188 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" |
2189 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter | 2189 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter |
2190 __ Push(load_name, r3, r0); // "next", iter, received | 2190 __ Push(load_name, r3, r0); // "next", iter, received |
2191 | 2191 |
2192 // result = receiver[f](arg); | 2192 // result = receiver[f](arg); |
2193 __ bind(&l_call); | 2193 __ bind(&l_call); |
2194 __ ldr(load_receiver, MemOperand(sp, kPointerSize)); | 2194 __ ldr(load_receiver, MemOperand(sp, kPointerSize)); |
2195 __ ldr(load_name, MemOperand(sp, 2 * kPointerSize)); | 2195 __ ldr(load_name, MemOperand(sp, 2 * kPointerSize)); |
2196 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2196 __ mov(LoadDescriptor::SlotRegister(), |
2197 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2197 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2198 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2198 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
2199 CallIC(ic, TypeFeedbackId::None()); | 2199 CallIC(ic, TypeFeedbackId::None()); |
2200 __ mov(r1, r0); | 2200 __ mov(r1, r0); |
2201 __ str(r1, MemOperand(sp, 2 * kPointerSize)); | 2201 __ str(r1, MemOperand(sp, 2 * kPointerSize)); |
2202 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2202 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2203 __ CallStub(&stub); | 2203 __ CallStub(&stub); |
2204 | 2204 |
2205 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2205 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2206 __ Drop(1); // The function is still on the stack; drop it. | 2206 __ Drop(1); // The function is still on the stack; drop it. |
2207 | 2207 |
2208 // if (!result.done) goto l_try; | 2208 // if (!result.done) goto l_try; |
2209 __ bind(&l_loop); | 2209 __ bind(&l_loop); |
2210 __ Move(load_receiver, r0); | 2210 __ Move(load_receiver, r0); |
2211 | 2211 |
2212 __ push(load_receiver); // save result | 2212 __ push(load_receiver); // save result |
2213 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" | 2213 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" |
2214 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2214 __ mov(LoadDescriptor::SlotRegister(), |
2215 Operand(SmiFromSlot(expr->DoneFeedbackSlot()))); | 2215 Operand(SmiFromSlot(expr->DoneFeedbackSlot()))); |
2216 CallLoadIC(NOT_CONTEXTUAL); // r0=result.done | 2216 CallLoadIC(NOT_CONTEXTUAL); // r0=result.done |
2217 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2217 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
2218 CallIC(bool_ic); | 2218 CallIC(bool_ic); |
2219 __ cmp(r0, Operand(0)); | 2219 __ cmp(r0, Operand(0)); |
2220 __ b(eq, &l_try); | 2220 __ b(eq, &l_try); |
2221 | 2221 |
2222 // result.value | 2222 // result.value |
2223 __ pop(load_receiver); // result | 2223 __ pop(load_receiver); // result |
2224 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" | 2224 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" |
2225 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2225 __ mov(LoadDescriptor::SlotRegister(), |
2226 Operand(SmiFromSlot(expr->ValueFeedbackSlot()))); | 2226 Operand(SmiFromSlot(expr->ValueFeedbackSlot()))); |
2227 CallLoadIC(NOT_CONTEXTUAL); // r0=result.value | 2227 CallLoadIC(NOT_CONTEXTUAL); // r0=result.value |
2228 context()->DropAndPlug(2, r0); // drop iter and g | 2228 context()->DropAndPlug(2, r0); // drop iter and g |
2229 break; | 2229 break; |
2230 } | 2230 } |
2231 } | 2231 } |
2232 } | 2232 } |
2233 | 2233 |
2234 | 2234 |
2235 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 2235 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2368 r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); | 2368 r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); |
2369 } | 2369 } |
2370 | 2370 |
2371 | 2371 |
2372 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2372 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2373 SetSourcePosition(prop->position()); | 2373 SetSourcePosition(prop->position()); |
2374 Literal* key = prop->key()->AsLiteral(); | 2374 Literal* key = prop->key()->AsLiteral(); |
2375 DCHECK(!prop->IsSuperAccess()); | 2375 DCHECK(!prop->IsSuperAccess()); |
2376 | 2376 |
2377 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); | 2377 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); |
2378 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2378 __ mov(LoadDescriptor::SlotRegister(), |
2379 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2379 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2380 CallLoadIC(NOT_CONTEXTUAL); | 2380 CallLoadIC(NOT_CONTEXTUAL); |
2381 } | 2381 } |
2382 | 2382 |
2383 | 2383 |
2384 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2384 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
2385 // Stack: receiver, home_object. | 2385 // Stack: receiver, home_object. |
2386 SetSourcePosition(prop->position()); | 2386 SetSourcePosition(prop->position()); |
2387 Literal* key = prop->key()->AsLiteral(); | 2387 Literal* key = prop->key()->AsLiteral(); |
2388 DCHECK(!key->value()->IsSmi()); | 2388 DCHECK(!key->value()->IsSmi()); |
2389 DCHECK(prop->IsSuperAccess()); | 2389 DCHECK(prop->IsSuperAccess()); |
2390 | 2390 |
2391 __ Push(key->value()); | 2391 __ Push(key->value()); |
2392 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2392 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
2393 } | 2393 } |
2394 | 2394 |
2395 | 2395 |
2396 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2396 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2397 SetSourcePosition(prop->position()); | 2397 SetSourcePosition(prop->position()); |
2398 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2398 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
2399 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2399 __ mov(LoadDescriptor::SlotRegister(), |
2400 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2400 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2401 CallIC(ic); | 2401 CallIC(ic); |
2402 } | 2402 } |
2403 | 2403 |
2404 | 2404 |
2405 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2405 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2406 // Stack: receiver, home_object, key. | 2406 // Stack: receiver, home_object, key. |
2407 SetSourcePosition(prop->position()); | 2407 SetSourcePosition(prop->position()); |
2408 | 2408 |
2409 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2409 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
(...skipping 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4604 | 4604 |
4605 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4605 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
4606 // Push the builtins object as the receiver. | 4606 // Push the builtins object as the receiver. |
4607 Register receiver = LoadDescriptor::ReceiverRegister(); | 4607 Register receiver = LoadDescriptor::ReceiverRegister(); |
4608 __ ldr(receiver, GlobalObjectOperand()); | 4608 __ ldr(receiver, GlobalObjectOperand()); |
4609 __ ldr(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); | 4609 __ ldr(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); |
4610 __ push(receiver); | 4610 __ push(receiver); |
4611 | 4611 |
4612 // Load the function from the receiver. | 4612 // Load the function from the receiver. |
4613 __ mov(LoadDescriptor::NameRegister(), Operand(expr->name())); | 4613 __ mov(LoadDescriptor::NameRegister(), Operand(expr->name())); |
4614 __ mov(VectorLoadICDescriptor::SlotRegister(), | 4614 __ mov(LoadDescriptor::SlotRegister(), |
4615 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4615 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
4616 CallLoadIC(NOT_CONTEXTUAL); | 4616 CallLoadIC(NOT_CONTEXTUAL); |
4617 } | 4617 } |
4618 | 4618 |
4619 | 4619 |
4620 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4620 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4621 ZoneList<Expression*>* args = expr->arguments(); | 4621 ZoneList<Expression*>* args = expr->arguments(); |
4622 int arg_count = args->length(); | 4622 int arg_count = args->length(); |
4623 | 4623 |
4624 // Record source position of the IC call. | 4624 // Record source position of the IC call. |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5039 | 5039 |
5040 | 5040 |
5041 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { | 5041 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
5042 DCHECK(!context()->IsEffect()); | 5042 DCHECK(!context()->IsEffect()); |
5043 DCHECK(!context()->IsTest()); | 5043 DCHECK(!context()->IsTest()); |
5044 VariableProxy* proxy = expr->AsVariableProxy(); | 5044 VariableProxy* proxy = expr->AsVariableProxy(); |
5045 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 5045 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
5046 Comment cmnt(masm_, "[ Global variable"); | 5046 Comment cmnt(masm_, "[ Global variable"); |
5047 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 5047 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
5048 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->name())); | 5048 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->name())); |
5049 __ mov(VectorLoadICDescriptor::SlotRegister(), | 5049 __ mov(LoadDescriptor::SlotRegister(), |
5050 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 5050 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
5051 // Use a regular load, not a contextual load, to avoid a reference | 5051 // Use a regular load, not a contextual load, to avoid a reference |
5052 // error. | 5052 // error. |
5053 CallLoadIC(NOT_CONTEXTUAL); | 5053 CallLoadIC(NOT_CONTEXTUAL); |
5054 PrepareForBailout(expr, TOS_REG); | 5054 PrepareForBailout(expr, TOS_REG); |
5055 context()->Plug(r0); | 5055 context()->Plug(r0); |
5056 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 5056 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
5057 Comment cmnt(masm_, "[ Lookup slot"); | 5057 Comment cmnt(masm_, "[ Lookup slot"); |
5058 Label done, slow; | 5058 Label done, slow; |
5059 | 5059 |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5484 | 5484 |
5485 DCHECK(interrupt_address == | 5485 DCHECK(interrupt_address == |
5486 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5486 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5487 return OSR_AFTER_STACK_CHECK; | 5487 return OSR_AFTER_STACK_CHECK; |
5488 } | 5488 } |
5489 | 5489 |
5490 | 5490 |
5491 } } // namespace v8::internal | 5491 } } // namespace v8::internal |
5492 | 5492 |
5493 #endif // V8_TARGET_ARCH_ARM | 5493 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |