| 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
| 8 | 8 |
| 9 #include "code-stubs.h" | 9 #include "code-stubs.h" |
| 10 #include "codegen.h" | 10 #include "codegen.h" |
| (...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2269 | 2269 |
| 2270 // Only the value field needs a write barrier, as the other values are in the | 2270 // Only the value field needs a write barrier, as the other values are in the |
| 2271 // root set. | 2271 // root set. |
| 2272 __ RecordWriteField(r0, JSGeneratorObject::kResultValuePropertyOffset, | 2272 __ RecordWriteField(r0, JSGeneratorObject::kResultValuePropertyOffset, |
| 2273 r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); | 2273 r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); |
| 2274 } | 2274 } |
| 2275 | 2275 |
| 2276 | 2276 |
| 2277 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2277 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 2278 SetSourcePosition(prop->position()); | 2278 SetSourcePosition(prop->position()); |
| 2279 Literal* key = prop->key()->AsLiteral(); | 2279 Literal* key = prop->key()->AsStringLiteral(); |
| 2280 __ mov(r2, Operand(key->value())); | 2280 __ mov(r2, Operand(key->value())); |
| 2281 // Call load IC. It has arguments receiver and property name r0 and r2. | 2281 // Call load IC. It has arguments receiver and property name r0 and r2. |
| 2282 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 2282 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
| 2283 } | 2283 } |
| 2284 | 2284 |
| 2285 | 2285 |
| 2286 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2286 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2287 SetSourcePosition(prop->position()); | 2287 SetSourcePosition(prop->position()); |
| 2288 // Call keyed load IC. It has arguments key and receiver in r0 and r1. | 2288 // Call keyed load IC. It has arguments key and receiver in r0 and r1. |
| 2289 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 2289 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2416 Variable* var = expr->AsVariableProxy()->var(); | 2416 Variable* var = expr->AsVariableProxy()->var(); |
| 2417 EffectContext context(this); | 2417 EffectContext context(this); |
| 2418 EmitVariableAssignment(var, Token::ASSIGN); | 2418 EmitVariableAssignment(var, Token::ASSIGN); |
| 2419 break; | 2419 break; |
| 2420 } | 2420 } |
| 2421 case NAMED_PROPERTY: { | 2421 case NAMED_PROPERTY: { |
| 2422 __ push(r0); // Preserve value. | 2422 __ push(r0); // Preserve value. |
| 2423 VisitForAccumulatorValue(prop->obj()); | 2423 VisitForAccumulatorValue(prop->obj()); |
| 2424 __ mov(r1, r0); | 2424 __ mov(r1, r0); |
| 2425 __ pop(r0); // Restore value. | 2425 __ pop(r0); // Restore value. |
| 2426 __ mov(r2, Operand(prop->key()->AsLiteral()->value())); | 2426 __ mov(r2, Operand(prop->key()->AsStringLiteral()->value())); |
| 2427 CallStoreIC(); | 2427 CallStoreIC(); |
| 2428 break; | 2428 break; |
| 2429 } | 2429 } |
| 2430 case KEYED_PROPERTY: { | 2430 case KEYED_PROPERTY: { |
| 2431 __ push(r0); // Preserve value. | 2431 __ push(r0); // Preserve value. |
| 2432 VisitForStackValue(prop->obj()); | 2432 VisitForStackValue(prop->obj()); |
| 2433 VisitForAccumulatorValue(prop->key()); | 2433 VisitForAccumulatorValue(prop->key()); |
| 2434 __ mov(r1, r0); | 2434 __ mov(r1, r0); |
| 2435 __ Pop(r0, r2); // r0 = restored value. | 2435 __ Pop(r0, r2); // r0 = restored value. |
| 2436 Handle<Code> ic = strict_mode() == SLOPPY | 2436 Handle<Code> ic = strict_mode() == SLOPPY |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2530 } | 2530 } |
| 2531 } | 2531 } |
| 2532 // Non-initializing assignments to consts are ignored. | 2532 // Non-initializing assignments to consts are ignored. |
| 2533 } | 2533 } |
| 2534 | 2534 |
| 2535 | 2535 |
| 2536 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2536 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
| 2537 // Assignment to a property, using a named store IC. | 2537 // Assignment to a property, using a named store IC. |
| 2538 Property* prop = expr->target()->AsProperty(); | 2538 Property* prop = expr->target()->AsProperty(); |
| 2539 ASSERT(prop != NULL); | 2539 ASSERT(prop != NULL); |
| 2540 ASSERT(prop->key()->AsLiteral() != NULL); | 2540 ASSERT(prop->key()->AsStringLiteral() != NULL); |
| 2541 | 2541 |
| 2542 // Record source code position before IC call. | 2542 // Record source code position before IC call. |
| 2543 SetSourcePosition(expr->position()); | 2543 SetSourcePosition(expr->position()); |
| 2544 __ mov(r2, Operand(prop->key()->AsLiteral()->value())); | 2544 __ mov(r2, Operand(prop->key()->AsStringLiteral()->value())); |
| 2545 __ pop(r1); | 2545 __ pop(r1); |
| 2546 | 2546 |
| 2547 CallStoreIC(expr->AssignmentFeedbackId()); | 2547 CallStoreIC(expr->AssignmentFeedbackId()); |
| 2548 | 2548 |
| 2549 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2549 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 2550 context()->Plug(r0); | 2550 context()->Plug(r0); |
| 2551 } | 2551 } |
| 2552 | 2552 |
| 2553 | 2553 |
| 2554 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 2554 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3358 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset), eq); | 3358 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset), eq); |
| 3359 | 3359 |
| 3360 __ bind(&done); | 3360 __ bind(&done); |
| 3361 context()->Plug(r0); | 3361 context()->Plug(r0); |
| 3362 } | 3362 } |
| 3363 | 3363 |
| 3364 | 3364 |
| 3365 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { | 3365 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
| 3366 ZoneList<Expression*>* args = expr->arguments(); | 3366 ZoneList<Expression*>* args = expr->arguments(); |
| 3367 ASSERT(args->length() == 2); | 3367 ASSERT(args->length() == 2); |
| 3368 ASSERT_NE(NULL, args->at(1)->AsLiteral()); | 3368 ASSERT_NE(NULL, args->at(1)->AsNumberLiteral()); |
| 3369 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); | 3369 Smi* index = Smi::cast(*(args->at(1)->AsNumberLiteral()->value())); |
| 3370 | 3370 |
| 3371 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3371 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 3372 | 3372 |
| 3373 Label runtime, done, not_date_object; | 3373 Label runtime, done, not_date_object; |
| 3374 Register object = r0; | 3374 Register object = r0; |
| 3375 Register result = r0; | 3375 Register result = r0; |
| 3376 Register scratch0 = r9; | 3376 Register scratch0 = r9; |
| 3377 Register scratch1 = r1; | 3377 Register scratch1 = r1; |
| 3378 | 3378 |
| 3379 __ JumpIfSmi(object, ¬_date_object); | 3379 __ JumpIfSmi(object, ¬_date_object); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3706 __ pop(r1); | 3706 __ pop(r1); |
| 3707 __ pop(r2); | 3707 __ pop(r2); |
| 3708 __ CallStub(&stub); | 3708 __ CallStub(&stub); |
| 3709 context()->Plug(r0); | 3709 context()->Plug(r0); |
| 3710 } | 3710 } |
| 3711 | 3711 |
| 3712 | 3712 |
| 3713 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { | 3713 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { |
| 3714 ZoneList<Expression*>* args = expr->arguments(); | 3714 ZoneList<Expression*>* args = expr->arguments(); |
| 3715 ASSERT_EQ(2, args->length()); | 3715 ASSERT_EQ(2, args->length()); |
| 3716 ASSERT_NE(NULL, args->at(0)->AsLiteral()); | 3716 ASSERT_NE(NULL, args->at(0)->AsNumberLiteral()); |
| 3717 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); | 3717 int cache_id = Smi::cast(*(args->at(0)->AsNumberLiteral()->value()))->value(); |
| 3718 | 3718 |
| 3719 Handle<FixedArray> jsfunction_result_caches( | 3719 Handle<FixedArray> jsfunction_result_caches( |
| 3720 isolate()->native_context()->jsfunction_result_caches()); | 3720 isolate()->native_context()->jsfunction_result_caches()); |
| 3721 if (jsfunction_result_caches->length() <= cache_id) { | 3721 if (jsfunction_result_caches->length() <= cache_id) { |
| 3722 __ Abort(kAttemptToUseUndefinedCache); | 3722 __ Abort(kAttemptToUseUndefinedCache); |
| 3723 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 3723 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
| 3724 context()->Plug(r0); | 3724 context()->Plug(r0); |
| 3725 return; | 3725 return; |
| 3726 } | 3726 } |
| 3727 | 3727 |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4333 context()->PlugTOS(); | 4333 context()->PlugTOS(); |
| 4334 } | 4334 } |
| 4335 } else { | 4335 } else { |
| 4336 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 4336 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
| 4337 Token::ASSIGN); | 4337 Token::ASSIGN); |
| 4338 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4338 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 4339 context()->Plug(r0); | 4339 context()->Plug(r0); |
| 4340 } | 4340 } |
| 4341 break; | 4341 break; |
| 4342 case NAMED_PROPERTY: { | 4342 case NAMED_PROPERTY: { |
| 4343 __ mov(r2, Operand(prop->key()->AsLiteral()->value())); | 4343 __ mov(r2, Operand(prop->key()->AsStringLiteral()->value())); |
| 4344 __ pop(r1); | 4344 __ pop(r1); |
| 4345 CallStoreIC(expr->CountStoreFeedbackId()); | 4345 CallStoreIC(expr->CountStoreFeedbackId()); |
| 4346 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4346 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 4347 if (expr->is_postfix()) { | 4347 if (expr->is_postfix()) { |
| 4348 if (!context()->IsEffect()) { | 4348 if (!context()->IsEffect()) { |
| 4349 context()->PlugTOS(); | 4349 context()->PlugTOS(); |
| 4350 } | 4350 } |
| 4351 } else { | 4351 } else { |
| 4352 context()->Plug(r0); | 4352 context()->Plug(r0); |
| 4353 } | 4353 } |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4831 | 4831 |
| 4832 ASSERT(interrupt_address == | 4832 ASSERT(interrupt_address == |
| 4833 isolate->builtins()->OsrAfterStackCheck()->entry()); | 4833 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 4834 return OSR_AFTER_STACK_CHECK; | 4834 return OSR_AFTER_STACK_CHECK; |
| 4835 } | 4835 } |
| 4836 | 4836 |
| 4837 | 4837 |
| 4838 } } // namespace v8::internal | 4838 } } // namespace v8::internal |
| 4839 | 4839 |
| 4840 #endif // V8_TARGET_ARCH_ARM | 4840 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |