| 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 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1687 __ push(v0); // Save result on stack. | 1687 __ push(v0); // Save result on stack. |
| 1688 result_saved = true; | 1688 result_saved = true; |
| 1689 } | 1689 } |
| 1690 switch (property->kind()) { | 1690 switch (property->kind()) { |
| 1691 case ObjectLiteral::Property::CONSTANT: | 1691 case ObjectLiteral::Property::CONSTANT: |
| 1692 UNREACHABLE(); | 1692 UNREACHABLE(); |
| 1693 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1693 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| 1694 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); | 1694 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); |
| 1695 // Fall through. | 1695 // Fall through. |
| 1696 case ObjectLiteral::Property::COMPUTED: | 1696 case ObjectLiteral::Property::COMPUTED: |
| 1697 if (key->handle()->IsInternalizedString()) { | 1697 if (key->value()->IsInternalizedString()) { |
| 1698 if (property->emit_store()) { | 1698 if (property->emit_store()) { |
| 1699 VisitForAccumulatorValue(value); | 1699 VisitForAccumulatorValue(value); |
| 1700 __ mov(a0, result_register()); | 1700 __ mov(a0, result_register()); |
| 1701 __ li(a2, Operand(key->handle())); | 1701 __ li(a2, Operand(key->value())); |
| 1702 __ lw(a1, MemOperand(sp)); | 1702 __ lw(a1, MemOperand(sp)); |
| 1703 Handle<Code> ic = is_classic_mode() | 1703 Handle<Code> ic = is_classic_mode() |
| 1704 ? isolate()->builtins()->StoreIC_Initialize() | 1704 ? isolate()->builtins()->StoreIC_Initialize() |
| 1705 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 1705 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
| 1706 CallIC(ic, RelocInfo::CODE_TARGET, key->LiteralFeedbackId()); | 1706 CallIC(ic, RelocInfo::CODE_TARGET, key->LiteralFeedbackId()); |
| 1707 PrepareForBailoutForId(key->id(), NO_REGISTERS); | 1707 PrepareForBailoutForId(key->id(), NO_REGISTERS); |
| 1708 } else { | 1708 } else { |
| 1709 VisitForEffect(value); | 1709 VisitForEffect(value); |
| 1710 } | 1710 } |
| 1711 break; | 1711 break; |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2264 __ RecordWriteField(a0, JSGeneratorObject::kResultValuePropertyOffset, | 2264 __ RecordWriteField(a0, JSGeneratorObject::kResultValuePropertyOffset, |
| 2265 a2, a3, kRAHasBeenSaved, kDontSaveFPRegs); | 2265 a2, a3, kRAHasBeenSaved, kDontSaveFPRegs); |
| 2266 __ mov(result_register(), a0); | 2266 __ mov(result_register(), a0); |
| 2267 } | 2267 } |
| 2268 | 2268 |
| 2269 | 2269 |
| 2270 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2270 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 2271 SetSourcePosition(prop->position()); | 2271 SetSourcePosition(prop->position()); |
| 2272 Literal* key = prop->key()->AsLiteral(); | 2272 Literal* key = prop->key()->AsLiteral(); |
| 2273 __ mov(a0, result_register()); | 2273 __ mov(a0, result_register()); |
| 2274 __ li(a2, Operand(key->handle())); | 2274 __ li(a2, Operand(key->value())); |
| 2275 // Call load IC. It has arguments receiver and property name a0 and a2. | 2275 // Call load IC. It has arguments receiver and property name a0 and a2. |
| 2276 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2276 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| 2277 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); | 2277 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); |
| 2278 } | 2278 } |
| 2279 | 2279 |
| 2280 | 2280 |
| 2281 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2281 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2282 SetSourcePosition(prop->position()); | 2282 SetSourcePosition(prop->position()); |
| 2283 __ mov(a0, result_register()); | 2283 __ mov(a0, result_register()); |
| 2284 // Call keyed load IC. It has arguments key and receiver in a0 and a1. | 2284 // Call keyed load IC. It has arguments key and receiver in a0 and a1. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2426 Variable* var = expr->AsVariableProxy()->var(); | 2426 Variable* var = expr->AsVariableProxy()->var(); |
| 2427 EffectContext context(this); | 2427 EffectContext context(this); |
| 2428 EmitVariableAssignment(var, Token::ASSIGN); | 2428 EmitVariableAssignment(var, Token::ASSIGN); |
| 2429 break; | 2429 break; |
| 2430 } | 2430 } |
| 2431 case NAMED_PROPERTY: { | 2431 case NAMED_PROPERTY: { |
| 2432 __ push(result_register()); // Preserve value. | 2432 __ push(result_register()); // Preserve value. |
| 2433 VisitForAccumulatorValue(prop->obj()); | 2433 VisitForAccumulatorValue(prop->obj()); |
| 2434 __ mov(a1, result_register()); | 2434 __ mov(a1, result_register()); |
| 2435 __ pop(a0); // Restore value. | 2435 __ pop(a0); // Restore value. |
| 2436 __ li(a2, Operand(prop->key()->AsLiteral()->handle())); | 2436 __ li(a2, Operand(prop->key()->AsLiteral()->value())); |
| 2437 Handle<Code> ic = is_classic_mode() | 2437 Handle<Code> ic = is_classic_mode() |
| 2438 ? isolate()->builtins()->StoreIC_Initialize() | 2438 ? isolate()->builtins()->StoreIC_Initialize() |
| 2439 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 2439 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
| 2440 CallIC(ic); | 2440 CallIC(ic); |
| 2441 break; | 2441 break; |
| 2442 } | 2442 } |
| 2443 case KEYED_PROPERTY: { | 2443 case KEYED_PROPERTY: { |
| 2444 __ push(result_register()); // Preserve value. | 2444 __ push(result_register()); // Preserve value. |
| 2445 VisitForStackValue(prop->obj()); | 2445 VisitForStackValue(prop->obj()); |
| 2446 VisitForAccumulatorValue(prop->key()); | 2446 VisitForAccumulatorValue(prop->key()); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2557 | 2557 |
| 2558 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2558 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
| 2559 // Assignment to a property, using a named store IC. | 2559 // Assignment to a property, using a named store IC. |
| 2560 Property* prop = expr->target()->AsProperty(); | 2560 Property* prop = expr->target()->AsProperty(); |
| 2561 ASSERT(prop != NULL); | 2561 ASSERT(prop != NULL); |
| 2562 ASSERT(prop->key()->AsLiteral() != NULL); | 2562 ASSERT(prop->key()->AsLiteral() != NULL); |
| 2563 | 2563 |
| 2564 // Record source code position before IC call. | 2564 // Record source code position before IC call. |
| 2565 SetSourcePosition(expr->position()); | 2565 SetSourcePosition(expr->position()); |
| 2566 __ mov(a0, result_register()); // Load the value. | 2566 __ mov(a0, result_register()); // Load the value. |
| 2567 __ li(a2, Operand(prop->key()->AsLiteral()->handle())); | 2567 __ li(a2, Operand(prop->key()->AsLiteral()->value())); |
| 2568 __ pop(a1); | 2568 __ pop(a1); |
| 2569 | 2569 |
| 2570 Handle<Code> ic = is_classic_mode() | 2570 Handle<Code> ic = is_classic_mode() |
| 2571 ? isolate()->builtins()->StoreIC_Initialize() | 2571 ? isolate()->builtins()->StoreIC_Initialize() |
| 2572 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 2572 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
| 2573 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); | 2573 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); |
| 2574 | 2574 |
| 2575 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2575 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 2576 context()->Plug(v0); | 2576 context()->Plug(v0); |
| 2577 } | 2577 } |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2835 // The receiver is either the global receiver or an object found | 2835 // The receiver is either the global receiver or an object found |
| 2836 // by LoadContextSlot. That object could be the hole if the | 2836 // by LoadContextSlot. That object could be the hole if the |
| 2837 // receiver is implicitly the global object. | 2837 // receiver is implicitly the global object. |
| 2838 EmitCallWithStub(expr, RECEIVER_MIGHT_BE_IMPLICIT); | 2838 EmitCallWithStub(expr, RECEIVER_MIGHT_BE_IMPLICIT); |
| 2839 } else if (property != NULL) { | 2839 } else if (property != NULL) { |
| 2840 { PreservePositionScope scope(masm()->positions_recorder()); | 2840 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2841 VisitForStackValue(property->obj()); | 2841 VisitForStackValue(property->obj()); |
| 2842 } | 2842 } |
| 2843 if (property->key()->IsPropertyName()) { | 2843 if (property->key()->IsPropertyName()) { |
| 2844 EmitCallWithIC(expr, | 2844 EmitCallWithIC(expr, |
| 2845 property->key()->AsLiteral()->handle(), | 2845 property->key()->AsLiteral()->value(), |
| 2846 RelocInfo::CODE_TARGET); | 2846 RelocInfo::CODE_TARGET); |
| 2847 } else { | 2847 } else { |
| 2848 EmitKeyedCallWithIC(expr, property->key()); | 2848 EmitKeyedCallWithIC(expr, property->key()); |
| 2849 } | 2849 } |
| 2850 } else { | 2850 } else { |
| 2851 // Call to an arbitrary expression not handled specially above. | 2851 // Call to an arbitrary expression not handled specially above. |
| 2852 { PreservePositionScope scope(masm()->positions_recorder()); | 2852 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2853 VisitForStackValue(callee); | 2853 VisitForStackValue(callee); |
| 2854 } | 2854 } |
| 2855 // Load global receiver object. | 2855 // Load global receiver object. |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3440 | 3440 |
| 3441 __ bind(&done); | 3441 __ bind(&done); |
| 3442 context()->Plug(v0); | 3442 context()->Plug(v0); |
| 3443 } | 3443 } |
| 3444 | 3444 |
| 3445 | 3445 |
| 3446 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { | 3446 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
| 3447 ZoneList<Expression*>* args = expr->arguments(); | 3447 ZoneList<Expression*>* args = expr->arguments(); |
| 3448 ASSERT(args->length() == 2); | 3448 ASSERT(args->length() == 2); |
| 3449 ASSERT_NE(NULL, args->at(1)->AsLiteral()); | 3449 ASSERT_NE(NULL, args->at(1)->AsLiteral()); |
| 3450 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle())); | 3450 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); |
| 3451 | 3451 |
| 3452 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3452 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 3453 | 3453 |
| 3454 Label runtime, done, not_date_object; | 3454 Label runtime, done, not_date_object; |
| 3455 Register object = v0; | 3455 Register object = v0; |
| 3456 Register result = v0; | 3456 Register result = v0; |
| 3457 Register scratch0 = t5; | 3457 Register scratch0 = t5; |
| 3458 Register scratch1 = a1; | 3458 Register scratch1 = a1; |
| 3459 | 3459 |
| 3460 __ JumpIfSmi(object, ¬_date_object); | 3460 __ JumpIfSmi(object, ¬_date_object); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3872 __ CallStub(&stub); | 3872 __ CallStub(&stub); |
| 3873 context()->Plug(v0); | 3873 context()->Plug(v0); |
| 3874 } | 3874 } |
| 3875 | 3875 |
| 3876 | 3876 |
| 3877 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { | 3877 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { |
| 3878 ZoneList<Expression*>* args = expr->arguments(); | 3878 ZoneList<Expression*>* args = expr->arguments(); |
| 3879 ASSERT_EQ(2, args->length()); | 3879 ASSERT_EQ(2, args->length()); |
| 3880 | 3880 |
| 3881 ASSERT_NE(NULL, args->at(0)->AsLiteral()); | 3881 ASSERT_NE(NULL, args->at(0)->AsLiteral()); |
| 3882 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value(); | 3882 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); |
| 3883 | 3883 |
| 3884 Handle<FixedArray> jsfunction_result_caches( | 3884 Handle<FixedArray> jsfunction_result_caches( |
| 3885 isolate()->native_context()->jsfunction_result_caches()); | 3885 isolate()->native_context()->jsfunction_result_caches()); |
| 3886 if (jsfunction_result_caches->length() <= cache_id) { | 3886 if (jsfunction_result_caches->length() <= cache_id) { |
| 3887 __ Abort("Attempt to use undefined cache."); | 3887 __ Abort("Attempt to use undefined cache."); |
| 3888 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | 3888 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
| 3889 context()->Plug(v0); | 3889 context()->Plug(v0); |
| 3890 return; | 3890 return; |
| 3891 } | 3891 } |
| 3892 | 3892 |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4547 } | 4547 } |
| 4548 } else { | 4548 } else { |
| 4549 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 4549 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
| 4550 Token::ASSIGN); | 4550 Token::ASSIGN); |
| 4551 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4551 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 4552 context()->Plug(v0); | 4552 context()->Plug(v0); |
| 4553 } | 4553 } |
| 4554 break; | 4554 break; |
| 4555 case NAMED_PROPERTY: { | 4555 case NAMED_PROPERTY: { |
| 4556 __ mov(a0, result_register()); // Value. | 4556 __ mov(a0, result_register()); // Value. |
| 4557 __ li(a2, Operand(prop->key()->AsLiteral()->handle())); // Name. | 4557 __ li(a2, Operand(prop->key()->AsLiteral()->value())); // Name. |
| 4558 __ pop(a1); // Receiver. | 4558 __ pop(a1); // Receiver. |
| 4559 Handle<Code> ic = is_classic_mode() | 4559 Handle<Code> ic = is_classic_mode() |
| 4560 ? isolate()->builtins()->StoreIC_Initialize() | 4560 ? isolate()->builtins()->StoreIC_Initialize() |
| 4561 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 4561 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
| 4562 CallIC(ic, RelocInfo::CODE_TARGET, expr->CountStoreFeedbackId()); | 4562 CallIC(ic, RelocInfo::CODE_TARGET, expr->CountStoreFeedbackId()); |
| 4563 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4563 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 4564 if (expr->is_postfix()) { | 4564 if (expr->is_postfix()) { |
| 4565 if (!context()->IsEffect()) { | 4565 if (!context()->IsEffect()) { |
| 4566 context()->PlugTOS(); | 4566 context()->PlugTOS(); |
| 4567 } | 4567 } |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4951 *context_length = 0; | 4951 *context_length = 0; |
| 4952 return previous_; | 4952 return previous_; |
| 4953 } | 4953 } |
| 4954 | 4954 |
| 4955 | 4955 |
| 4956 #undef __ | 4956 #undef __ |
| 4957 | 4957 |
| 4958 } } // namespace v8::internal | 4958 } } // namespace v8::internal |
| 4959 | 4959 |
| 4960 #endif // V8_TARGET_ARCH_MIPS | 4960 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |