| 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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 8 | 8 |
| 9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
| 10 // | 10 // |
| (...skipping 2255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2266 | 2266 |
| 2267 // Only the value field needs a write barrier, as the other values are in the | 2267 // Only the value field needs a write barrier, as the other values are in the |
| 2268 // root set. | 2268 // root set. |
| 2269 __ RecordWriteField(v0, JSGeneratorObject::kResultValuePropertyOffset, | 2269 __ RecordWriteField(v0, JSGeneratorObject::kResultValuePropertyOffset, |
| 2270 a2, a3, kRAHasBeenSaved, kDontSaveFPRegs); | 2270 a2, a3, kRAHasBeenSaved, kDontSaveFPRegs); |
| 2271 } | 2271 } |
| 2272 | 2272 |
| 2273 | 2273 |
| 2274 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2274 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 2275 SetSourcePosition(prop->position()); | 2275 SetSourcePosition(prop->position()); |
| 2276 Literal* key = prop->key()->AsLiteral(); | 2276 Literal* key = prop->key()->AsStringLiteral(); |
| 2277 __ mov(a0, result_register()); | 2277 __ mov(a0, result_register()); |
| 2278 __ li(a2, Operand(key->value())); | 2278 __ li(a2, Operand(key->value())); |
| 2279 // Call load IC. It has arguments receiver and property name a0 and a2. | 2279 // Call load IC. It has arguments receiver and property name a0 and a2. |
| 2280 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 2280 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
| 2281 } | 2281 } |
| 2282 | 2282 |
| 2283 | 2283 |
| 2284 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2284 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2285 SetSourcePosition(prop->position()); | 2285 SetSourcePosition(prop->position()); |
| 2286 __ mov(a0, result_register()); | 2286 __ mov(a0, result_register()); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2418 Variable* var = expr->AsVariableProxy()->var(); | 2418 Variable* var = expr->AsVariableProxy()->var(); |
| 2419 EffectContext context(this); | 2419 EffectContext context(this); |
| 2420 EmitVariableAssignment(var, Token::ASSIGN); | 2420 EmitVariableAssignment(var, Token::ASSIGN); |
| 2421 break; | 2421 break; |
| 2422 } | 2422 } |
| 2423 case NAMED_PROPERTY: { | 2423 case NAMED_PROPERTY: { |
| 2424 __ push(result_register()); // Preserve value. | 2424 __ push(result_register()); // Preserve value. |
| 2425 VisitForAccumulatorValue(prop->obj()); | 2425 VisitForAccumulatorValue(prop->obj()); |
| 2426 __ mov(a1, result_register()); | 2426 __ mov(a1, result_register()); |
| 2427 __ pop(a0); // Restore value. | 2427 __ pop(a0); // Restore value. |
| 2428 __ li(a2, Operand(prop->key()->AsLiteral()->value())); | 2428 __ li(a2, Operand(prop->key()->AsStringLiteral()->value())); |
| 2429 CallStoreIC(); | 2429 CallStoreIC(); |
| 2430 break; | 2430 break; |
| 2431 } | 2431 } |
| 2432 case KEYED_PROPERTY: { | 2432 case KEYED_PROPERTY: { |
| 2433 __ push(result_register()); // Preserve value. | 2433 __ push(result_register()); // Preserve value. |
| 2434 VisitForStackValue(prop->obj()); | 2434 VisitForStackValue(prop->obj()); |
| 2435 VisitForAccumulatorValue(prop->key()); | 2435 VisitForAccumulatorValue(prop->key()); |
| 2436 __ mov(a1, result_register()); | 2436 __ mov(a1, result_register()); |
| 2437 __ Pop(a0, a2); // a0 = restored value. | 2437 __ Pop(a0, a2); // a0 = restored value. |
| 2438 Handle<Code> ic = strict_mode() == SLOPPY | 2438 Handle<Code> ic = strict_mode() == SLOPPY |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2531 } | 2531 } |
| 2532 } | 2532 } |
| 2533 // Non-initializing assignments to consts are ignored. | 2533 // Non-initializing assignments to consts are ignored. |
| 2534 } | 2534 } |
| 2535 | 2535 |
| 2536 | 2536 |
| 2537 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2537 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
| 2538 // Assignment to a property, using a named store IC. | 2538 // Assignment to a property, using a named store IC. |
| 2539 Property* prop = expr->target()->AsProperty(); | 2539 Property* prop = expr->target()->AsProperty(); |
| 2540 ASSERT(prop != NULL); | 2540 ASSERT(prop != NULL); |
| 2541 ASSERT(prop->key()->AsLiteral() != NULL); | 2541 ASSERT(prop->key()->AsStringLiteral() != NULL); |
| 2542 | 2542 |
| 2543 // Record source code position before IC call. | 2543 // Record source code position before IC call. |
| 2544 SetSourcePosition(expr->position()); | 2544 SetSourcePosition(expr->position()); |
| 2545 __ mov(a0, result_register()); // Load the value. | 2545 __ mov(a0, result_register()); // Load the value. |
| 2546 __ li(a2, Operand(prop->key()->AsLiteral()->value())); | 2546 __ li(a2, Operand(prop->key()->AsStringLiteral()->value())); |
| 2547 __ pop(a1); | 2547 __ pop(a1); |
| 2548 | 2548 |
| 2549 CallStoreIC(expr->AssignmentFeedbackId()); | 2549 CallStoreIC(expr->AssignmentFeedbackId()); |
| 2550 | 2550 |
| 2551 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2551 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 2552 context()->Plug(v0); | 2552 context()->Plug(v0); |
| 2553 } | 2553 } |
| 2554 | 2554 |
| 2555 | 2555 |
| 2556 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 2556 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3370 __ lw(v0, FieldMemOperand(v0, JSValue::kValueOffset)); | 3370 __ lw(v0, FieldMemOperand(v0, JSValue::kValueOffset)); |
| 3371 | 3371 |
| 3372 __ bind(&done); | 3372 __ bind(&done); |
| 3373 context()->Plug(v0); | 3373 context()->Plug(v0); |
| 3374 } | 3374 } |
| 3375 | 3375 |
| 3376 | 3376 |
| 3377 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { | 3377 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
| 3378 ZoneList<Expression*>* args = expr->arguments(); | 3378 ZoneList<Expression*>* args = expr->arguments(); |
| 3379 ASSERT(args->length() == 2); | 3379 ASSERT(args->length() == 2); |
| 3380 ASSERT_NE(NULL, args->at(1)->AsLiteral()); | 3380 ASSERT_NE(NULL, args->at(1)->AsNumberLiteral()); |
| 3381 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); | 3381 Smi* index = Smi::cast(*(args->at(1)->AsNumberLiteral()->value())); |
| 3382 | 3382 |
| 3383 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3383 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 3384 | 3384 |
| 3385 Label runtime, done, not_date_object; | 3385 Label runtime, done, not_date_object; |
| 3386 Register object = v0; | 3386 Register object = v0; |
| 3387 Register result = v0; | 3387 Register result = v0; |
| 3388 Register scratch0 = t5; | 3388 Register scratch0 = t5; |
| 3389 Register scratch1 = a1; | 3389 Register scratch1 = a1; |
| 3390 | 3390 |
| 3391 __ JumpIfSmi(object, ¬_date_object); | 3391 __ JumpIfSmi(object, ¬_date_object); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3736 __ pop(a2); | 3736 __ pop(a2); |
| 3737 __ CallStub(&stub); | 3737 __ CallStub(&stub); |
| 3738 context()->Plug(v0); | 3738 context()->Plug(v0); |
| 3739 } | 3739 } |
| 3740 | 3740 |
| 3741 | 3741 |
| 3742 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { | 3742 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { |
| 3743 ZoneList<Expression*>* args = expr->arguments(); | 3743 ZoneList<Expression*>* args = expr->arguments(); |
| 3744 ASSERT_EQ(2, args->length()); | 3744 ASSERT_EQ(2, args->length()); |
| 3745 | 3745 |
| 3746 ASSERT_NE(NULL, args->at(0)->AsLiteral()); | 3746 ASSERT_NE(NULL, args->at(0)->AsNumberLiteral()); |
| 3747 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); | 3747 int cache_id = Smi::cast(*(args->at(0)->AsNumberLiteral()->value()))->value(); |
| 3748 | 3748 |
| 3749 Handle<FixedArray> jsfunction_result_caches( | 3749 Handle<FixedArray> jsfunction_result_caches( |
| 3750 isolate()->native_context()->jsfunction_result_caches()); | 3750 isolate()->native_context()->jsfunction_result_caches()); |
| 3751 if (jsfunction_result_caches->length() <= cache_id) { | 3751 if (jsfunction_result_caches->length() <= cache_id) { |
| 3752 __ Abort(kAttemptToUseUndefinedCache); | 3752 __ Abort(kAttemptToUseUndefinedCache); |
| 3753 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | 3753 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
| 3754 context()->Plug(v0); | 3754 context()->Plug(v0); |
| 3755 return; | 3755 return; |
| 3756 } | 3756 } |
| 3757 | 3757 |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4374 } | 4374 } |
| 4375 } else { | 4375 } else { |
| 4376 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 4376 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
| 4377 Token::ASSIGN); | 4377 Token::ASSIGN); |
| 4378 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4378 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 4379 context()->Plug(v0); | 4379 context()->Plug(v0); |
| 4380 } | 4380 } |
| 4381 break; | 4381 break; |
| 4382 case NAMED_PROPERTY: { | 4382 case NAMED_PROPERTY: { |
| 4383 __ mov(a0, result_register()); // Value. | 4383 __ mov(a0, result_register()); // Value. |
| 4384 __ li(a2, Operand(prop->key()->AsLiteral()->value())); // Name. | 4384 __ li(a2, Operand(prop->key()->AsStringLiteral()->value())); // Name. |
| 4385 __ pop(a1); // Receiver. | 4385 __ pop(a1); // Receiver. |
| 4386 CallStoreIC(expr->CountStoreFeedbackId()); | 4386 CallStoreIC(expr->CountStoreFeedbackId()); |
| 4387 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4387 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 4388 if (expr->is_postfix()) { | 4388 if (expr->is_postfix()) { |
| 4389 if (!context()->IsEffect()) { | 4389 if (!context()->IsEffect()) { |
| 4390 context()->PlugTOS(); | 4390 context()->PlugTOS(); |
| 4391 } | 4391 } |
| 4392 } else { | 4392 } else { |
| 4393 context()->Plug(v0); | 4393 context()->Plug(v0); |
| 4394 } | 4394 } |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4852 Assembler::target_address_at(pc_immediate_load_address)) == | 4852 Assembler::target_address_at(pc_immediate_load_address)) == |
| 4853 reinterpret_cast<uint32_t>( | 4853 reinterpret_cast<uint32_t>( |
| 4854 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4854 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 4855 return OSR_AFTER_STACK_CHECK; | 4855 return OSR_AFTER_STACK_CHECK; |
| 4856 } | 4856 } |
| 4857 | 4857 |
| 4858 | 4858 |
| 4859 } } // namespace v8::internal | 4859 } } // namespace v8::internal |
| 4860 | 4860 |
| 4861 #endif // V8_TARGET_ARCH_MIPS | 4861 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |