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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2519 break; | 2519 break; |
2520 default: | 2520 default: |
2521 UNREACHABLE(); | 2521 UNREACHABLE(); |
2522 } | 2522 } |
2523 | 2523 |
2524 __ bind(&done); | 2524 __ bind(&done); |
2525 context()->Plug(v0); | 2525 context()->Plug(v0); |
2526 } | 2526 } |
2527 | 2527 |
2528 | 2528 |
2529 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | 2529 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit, |
| 2530 int* used_store_slots) { |
2530 // Constructor is in v0. | 2531 // Constructor is in v0. |
2531 DCHECK(lit != NULL); | 2532 DCHECK(lit != NULL); |
2532 __ push(v0); | 2533 __ push(v0); |
2533 | 2534 |
2534 // No access check is needed here since the constructor is created by the | 2535 // No access check is needed here since the constructor is created by the |
2535 // class literal. | 2536 // class literal. |
2536 Register scratch = a1; | 2537 Register scratch = a1; |
2537 __ lw(scratch, | 2538 __ lw(scratch, |
2538 FieldMemOperand(v0, JSFunction::kPrototypeOrInitialMapOffset)); | 2539 FieldMemOperand(v0, JSFunction::kPrototypeOrInitialMapOffset)); |
2539 __ push(scratch); | 2540 __ push(scratch); |
2540 | 2541 |
2541 // store_slot_index points to the vector IC slot for the next store IC used. | |
2542 // ClassLiteral::ComputeFeedbackRequirements controls the allocation of slots | |
2543 // and must be updated if the number of store ICs emitted here changes. | |
2544 int store_slot_index = 0; | |
2545 for (int i = 0; i < lit->properties()->length(); i++) { | 2542 for (int i = 0; i < lit->properties()->length(); i++) { |
2546 ObjectLiteral::Property* property = lit->properties()->at(i); | 2543 ObjectLiteral::Property* property = lit->properties()->at(i); |
2547 Expression* value = property->value(); | 2544 Expression* value = property->value(); |
2548 | 2545 |
2549 if (property->is_static()) { | 2546 if (property->is_static()) { |
2550 __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor | 2547 __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor |
2551 } else { | 2548 } else { |
2552 __ lw(scratch, MemOperand(sp, 0)); // prototype | 2549 __ lw(scratch, MemOperand(sp, 0)); // prototype |
2553 } | 2550 } |
2554 __ push(scratch); | 2551 __ push(scratch); |
2555 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2552 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
2556 | 2553 |
2557 // The static prototype property is read only. We handle the non computed | 2554 // The static prototype property is read only. We handle the non computed |
2558 // property name case in the parser. Since this is the only case where we | 2555 // property name case in the parser. Since this is the only case where we |
2559 // need to check for an own read only property we special case this so we do | 2556 // need to check for an own read only property we special case this so we do |
2560 // not need to do this for every property. | 2557 // not need to do this for every property. |
2561 if (property->is_static() && property->is_computed_name()) { | 2558 if (property->is_static() && property->is_computed_name()) { |
2562 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); | 2559 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); |
2563 __ push(v0); | 2560 __ push(v0); |
2564 } | 2561 } |
2565 | 2562 |
2566 VisitForStackValue(value); | 2563 VisitForStackValue(value); |
2567 EmitSetHomeObjectIfNeeded(value, 2, | 2564 EmitSetHomeObjectIfNeeded(value, 2, |
2568 lit->SlotForHomeObject(value, &store_slot_index)); | 2565 lit->SlotForHomeObject(value, used_store_slots)); |
2569 | 2566 |
2570 switch (property->kind()) { | 2567 switch (property->kind()) { |
2571 case ObjectLiteral::Property::CONSTANT: | 2568 case ObjectLiteral::Property::CONSTANT: |
2572 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2569 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
2573 case ObjectLiteral::Property::PROTOTYPE: | 2570 case ObjectLiteral::Property::PROTOTYPE: |
2574 UNREACHABLE(); | 2571 UNREACHABLE(); |
2575 case ObjectLiteral::Property::COMPUTED: | 2572 case ObjectLiteral::Property::COMPUTED: |
2576 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2573 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
2577 break; | 2574 break; |
2578 | 2575 |
(...skipping 12 matching lines...) Expand all Loading... |
2591 default: | 2588 default: |
2592 UNREACHABLE(); | 2589 UNREACHABLE(); |
2593 } | 2590 } |
2594 } | 2591 } |
2595 | 2592 |
2596 // prototype | 2593 // prototype |
2597 __ CallRuntime(Runtime::kToFastProperties, 1); | 2594 __ CallRuntime(Runtime::kToFastProperties, 1); |
2598 | 2595 |
2599 // constructor | 2596 // constructor |
2600 __ CallRuntime(Runtime::kToFastProperties, 1); | 2597 __ CallRuntime(Runtime::kToFastProperties, 1); |
2601 | |
2602 // Verify that compilation exactly consumed the number of store ic slots that | |
2603 // the ClassLiteral node had to offer. | |
2604 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); | |
2605 } | 2598 } |
2606 | 2599 |
2607 | 2600 |
2608 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2601 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2609 __ mov(a0, result_register()); | 2602 __ mov(a0, result_register()); |
2610 __ pop(a1); | 2603 __ pop(a1); |
2611 Handle<Code> code = | 2604 Handle<Code> code = |
2612 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); | 2605 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
2613 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2606 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2614 CallIC(code, expr->BinaryOperationFeedbackId()); | 2607 CallIC(code, expr->BinaryOperationFeedbackId()); |
(...skipping 2931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5546 reinterpret_cast<uint32_t>( | 5539 reinterpret_cast<uint32_t>( |
5547 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5540 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5548 return OSR_AFTER_STACK_CHECK; | 5541 return OSR_AFTER_STACK_CHECK; |
5549 } | 5542 } |
5550 | 5543 |
5551 | 5544 |
5552 } // namespace internal | 5545 } // namespace internal |
5553 } // namespace v8 | 5546 } // namespace v8 |
5554 | 5547 |
5555 #endif // V8_TARGET_ARCH_MIPS | 5548 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |