OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 __ push(r0); // Save result on stack | 1685 __ push(r0); // Save result on stack |
1686 result_saved = true; | 1686 result_saved = true; |
1687 } | 1687 } |
1688 switch (property->kind()) { | 1688 switch (property->kind()) { |
1689 case ObjectLiteral::Property::CONSTANT: | 1689 case ObjectLiteral::Property::CONSTANT: |
1690 UNREACHABLE(); | 1690 UNREACHABLE(); |
1691 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1691 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
1692 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); | 1692 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); |
1693 // Fall through. | 1693 // Fall through. |
1694 case ObjectLiteral::Property::COMPUTED: | 1694 case ObjectLiteral::Property::COMPUTED: |
1695 if (key->handle()->IsInternalizedString()) { | 1695 if (key->value()->IsInternalizedString()) { |
1696 if (property->emit_store()) { | 1696 if (property->emit_store()) { |
1697 VisitForAccumulatorValue(value); | 1697 VisitForAccumulatorValue(value); |
1698 __ mov(r2, Operand(key->handle())); | 1698 __ mov(r2, Operand(key->value())); |
1699 __ ldr(r1, MemOperand(sp)); | 1699 __ ldr(r1, MemOperand(sp)); |
1700 Handle<Code> ic = is_classic_mode() | 1700 Handle<Code> ic = is_classic_mode() |
1701 ? isolate()->builtins()->StoreIC_Initialize() | 1701 ? isolate()->builtins()->StoreIC_Initialize() |
1702 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 1702 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
1703 CallIC(ic, RelocInfo::CODE_TARGET, key->LiteralFeedbackId()); | 1703 CallIC(ic, RelocInfo::CODE_TARGET, key->LiteralFeedbackId()); |
1704 PrepareForBailoutForId(key->id(), NO_REGISTERS); | 1704 PrepareForBailoutForId(key->id(), NO_REGISTERS); |
1705 } else { | 1705 } else { |
1706 VisitForEffect(value); | 1706 VisitForEffect(value); |
1707 } | 1707 } |
1708 break; | 1708 break; |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2254 // Only the value field needs a write barrier, as the other values are in the | 2254 // Only the value field needs a write barrier, as the other values are in the |
2255 // root set. | 2255 // root set. |
2256 __ RecordWriteField(r0, JSGeneratorObject::kResultValuePropertyOffset, | 2256 __ RecordWriteField(r0, JSGeneratorObject::kResultValuePropertyOffset, |
2257 r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); | 2257 r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); |
2258 } | 2258 } |
2259 | 2259 |
2260 | 2260 |
2261 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2261 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2262 SetSourcePosition(prop->position()); | 2262 SetSourcePosition(prop->position()); |
2263 Literal* key = prop->key()->AsLiteral(); | 2263 Literal* key = prop->key()->AsLiteral(); |
2264 __ mov(r2, Operand(key->handle())); | 2264 __ mov(r2, Operand(key->value())); |
2265 // Call load IC. It has arguments receiver and property name r0 and r2. | 2265 // Call load IC. It has arguments receiver and property name r0 and r2. |
2266 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2266 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
2267 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); | 2267 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); |
2268 } | 2268 } |
2269 | 2269 |
2270 | 2270 |
2271 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2271 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2272 SetSourcePosition(prop->position()); | 2272 SetSourcePosition(prop->position()); |
2273 // Call keyed load IC. It has arguments key and receiver in r0 and r1. | 2273 // Call keyed load IC. It has arguments key and receiver in r0 and r1. |
2274 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 2274 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2409 Variable* var = expr->AsVariableProxy()->var(); | 2409 Variable* var = expr->AsVariableProxy()->var(); |
2410 EffectContext context(this); | 2410 EffectContext context(this); |
2411 EmitVariableAssignment(var, Token::ASSIGN); | 2411 EmitVariableAssignment(var, Token::ASSIGN); |
2412 break; | 2412 break; |
2413 } | 2413 } |
2414 case NAMED_PROPERTY: { | 2414 case NAMED_PROPERTY: { |
2415 __ push(r0); // Preserve value. | 2415 __ push(r0); // Preserve value. |
2416 VisitForAccumulatorValue(prop->obj()); | 2416 VisitForAccumulatorValue(prop->obj()); |
2417 __ mov(r1, r0); | 2417 __ mov(r1, r0); |
2418 __ pop(r0); // Restore value. | 2418 __ pop(r0); // Restore value. |
2419 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); | 2419 __ mov(r2, Operand(prop->key()->AsLiteral()->value())); |
2420 Handle<Code> ic = is_classic_mode() | 2420 Handle<Code> ic = is_classic_mode() |
2421 ? isolate()->builtins()->StoreIC_Initialize() | 2421 ? isolate()->builtins()->StoreIC_Initialize() |
2422 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 2422 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
2423 CallIC(ic); | 2423 CallIC(ic); |
2424 break; | 2424 break; |
2425 } | 2425 } |
2426 case KEYED_PROPERTY: { | 2426 case KEYED_PROPERTY: { |
2427 __ push(r0); // Preserve value. | 2427 __ push(r0); // Preserve value. |
2428 VisitForStackValue(prop->obj()); | 2428 VisitForStackValue(prop->obj()); |
2429 VisitForAccumulatorValue(prop->key()); | 2429 VisitForAccumulatorValue(prop->key()); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2538 | 2538 |
2539 | 2539 |
2540 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2540 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2541 // Assignment to a property, using a named store IC. | 2541 // Assignment to a property, using a named store IC. |
2542 Property* prop = expr->target()->AsProperty(); | 2542 Property* prop = expr->target()->AsProperty(); |
2543 ASSERT(prop != NULL); | 2543 ASSERT(prop != NULL); |
2544 ASSERT(prop->key()->AsLiteral() != NULL); | 2544 ASSERT(prop->key()->AsLiteral() != NULL); |
2545 | 2545 |
2546 // Record source code position before IC call. | 2546 // Record source code position before IC call. |
2547 SetSourcePosition(expr->position()); | 2547 SetSourcePosition(expr->position()); |
2548 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); | 2548 __ mov(r2, Operand(prop->key()->AsLiteral()->value())); |
2549 __ pop(r1); | 2549 __ pop(r1); |
2550 | 2550 |
2551 Handle<Code> ic = is_classic_mode() | 2551 Handle<Code> ic = is_classic_mode() |
2552 ? isolate()->builtins()->StoreIC_Initialize() | 2552 ? isolate()->builtins()->StoreIC_Initialize() |
2553 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 2553 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
2554 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); | 2554 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); |
2555 | 2555 |
2556 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2556 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
2557 context()->Plug(r0); | 2557 context()->Plug(r0); |
2558 } | 2558 } |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 // The receiver is either the global receiver or an object found | 2812 // The receiver is either the global receiver or an object found |
2813 // by LoadContextSlot. That object could be the hole if the | 2813 // by LoadContextSlot. That object could be the hole if the |
2814 // receiver is implicitly the global object. | 2814 // receiver is implicitly the global object. |
2815 EmitCallWithStub(expr, RECEIVER_MIGHT_BE_IMPLICIT); | 2815 EmitCallWithStub(expr, RECEIVER_MIGHT_BE_IMPLICIT); |
2816 } else if (property != NULL) { | 2816 } else if (property != NULL) { |
2817 { PreservePositionScope scope(masm()->positions_recorder()); | 2817 { PreservePositionScope scope(masm()->positions_recorder()); |
2818 VisitForStackValue(property->obj()); | 2818 VisitForStackValue(property->obj()); |
2819 } | 2819 } |
2820 if (property->key()->IsPropertyName()) { | 2820 if (property->key()->IsPropertyName()) { |
2821 EmitCallWithIC(expr, | 2821 EmitCallWithIC(expr, |
2822 property->key()->AsLiteral()->handle(), | 2822 property->key()->AsLiteral()->value(), |
2823 RelocInfo::CODE_TARGET); | 2823 RelocInfo::CODE_TARGET); |
2824 } else { | 2824 } else { |
2825 EmitKeyedCallWithIC(expr, property->key()); | 2825 EmitKeyedCallWithIC(expr, property->key()); |
2826 } | 2826 } |
2827 } else { | 2827 } else { |
2828 // Call to an arbitrary expression not handled specially above. | 2828 // Call to an arbitrary expression not handled specially above. |
2829 { PreservePositionScope scope(masm()->positions_recorder()); | 2829 { PreservePositionScope scope(masm()->positions_recorder()); |
2830 VisitForStackValue(callee); | 2830 VisitForStackValue(callee); |
2831 } | 2831 } |
2832 // Load global receiver object. | 2832 // Load global receiver object. |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3420 | 3420 |
3421 __ bind(&done); | 3421 __ bind(&done); |
3422 context()->Plug(r0); | 3422 context()->Plug(r0); |
3423 } | 3423 } |
3424 | 3424 |
3425 | 3425 |
3426 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { | 3426 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
3427 ZoneList<Expression*>* args = expr->arguments(); | 3427 ZoneList<Expression*>* args = expr->arguments(); |
3428 ASSERT(args->length() == 2); | 3428 ASSERT(args->length() == 2); |
3429 ASSERT_NE(NULL, args->at(1)->AsLiteral()); | 3429 ASSERT_NE(NULL, args->at(1)->AsLiteral()); |
3430 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle())); | 3430 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); |
3431 | 3431 |
3432 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3432 VisitForAccumulatorValue(args->at(0)); // Load the object. |
3433 | 3433 |
3434 Label runtime, done, not_date_object; | 3434 Label runtime, done, not_date_object; |
3435 Register object = r0; | 3435 Register object = r0; |
3436 Register result = r0; | 3436 Register result = r0; |
3437 Register scratch0 = r9; | 3437 Register scratch0 = r9; |
3438 Register scratch1 = r1; | 3438 Register scratch1 = r1; |
3439 | 3439 |
3440 __ JumpIfSmi(object, ¬_date_object); | 3440 __ JumpIfSmi(object, ¬_date_object); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3839 VisitForStackValue(args->at(2)); | 3839 VisitForStackValue(args->at(2)); |
3840 __ CallStub(&stub); | 3840 __ CallStub(&stub); |
3841 context()->Plug(r0); | 3841 context()->Plug(r0); |
3842 } | 3842 } |
3843 | 3843 |
3844 | 3844 |
3845 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { | 3845 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { |
3846 ZoneList<Expression*>* args = expr->arguments(); | 3846 ZoneList<Expression*>* args = expr->arguments(); |
3847 ASSERT_EQ(2, args->length()); | 3847 ASSERT_EQ(2, args->length()); |
3848 ASSERT_NE(NULL, args->at(0)->AsLiteral()); | 3848 ASSERT_NE(NULL, args->at(0)->AsLiteral()); |
3849 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value(); | 3849 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); |
3850 | 3850 |
3851 Handle<FixedArray> jsfunction_result_caches( | 3851 Handle<FixedArray> jsfunction_result_caches( |
3852 isolate()->native_context()->jsfunction_result_caches()); | 3852 isolate()->native_context()->jsfunction_result_caches()); |
3853 if (jsfunction_result_caches->length() <= cache_id) { | 3853 if (jsfunction_result_caches->length() <= cache_id) { |
3854 __ Abort("Attempt to use undefined cache."); | 3854 __ Abort("Attempt to use undefined cache."); |
3855 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 3855 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
3856 context()->Plug(r0); | 3856 context()->Plug(r0); |
3857 return; | 3857 return; |
3858 } | 3858 } |
3859 | 3859 |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4512 context()->PlugTOS(); | 4512 context()->PlugTOS(); |
4513 } | 4513 } |
4514 } else { | 4514 } else { |
4515 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 4515 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
4516 Token::ASSIGN); | 4516 Token::ASSIGN); |
4517 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4517 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
4518 context()->Plug(r0); | 4518 context()->Plug(r0); |
4519 } | 4519 } |
4520 break; | 4520 break; |
4521 case NAMED_PROPERTY: { | 4521 case NAMED_PROPERTY: { |
4522 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); | 4522 __ mov(r2, Operand(prop->key()->AsLiteral()->value())); |
4523 __ pop(r1); | 4523 __ pop(r1); |
4524 Handle<Code> ic = is_classic_mode() | 4524 Handle<Code> ic = is_classic_mode() |
4525 ? isolate()->builtins()->StoreIC_Initialize() | 4525 ? isolate()->builtins()->StoreIC_Initialize() |
4526 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 4526 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
4527 CallIC(ic, RelocInfo::CODE_TARGET, expr->CountStoreFeedbackId()); | 4527 CallIC(ic, RelocInfo::CODE_TARGET, expr->CountStoreFeedbackId()); |
4528 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4528 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
4529 if (expr->is_postfix()) { | 4529 if (expr->is_postfix()) { |
4530 if (!context()->IsEffect()) { | 4530 if (!context()->IsEffect()) { |
4531 context()->PlugTOS(); | 4531 context()->PlugTOS(); |
4532 } | 4532 } |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4918 *context_length = 0; | 4918 *context_length = 0; |
4919 return previous_; | 4919 return previous_; |
4920 } | 4920 } |
4921 | 4921 |
4922 | 4922 |
4923 #undef __ | 4923 #undef __ |
4924 | 4924 |
4925 } } // namespace v8::internal | 4925 } } // namespace v8::internal |
4926 | 4926 |
4927 #endif // V8_TARGET_ARCH_ARM | 4927 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |