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 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 __ CallStub(&stub); | 1657 __ CallStub(&stub); |
1658 } | 1658 } |
1659 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); | 1659 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
1660 | 1660 |
1661 // If result_saved is true the result is on top of the stack. If | 1661 // If result_saved is true the result is on top of the stack. If |
1662 // result_saved is false the result is in v0. | 1662 // result_saved is false the result is in v0. |
1663 bool result_saved = false; | 1663 bool result_saved = false; |
1664 | 1664 |
1665 AccessorTable accessor_table(zone()); | 1665 AccessorTable accessor_table(zone()); |
1666 int property_index = 0; | 1666 int property_index = 0; |
1667 // store_slot_index points to the vector ic slot for the next store ic used. | 1667 // store_slot_index points to the vector IC slot for the next store IC used. |
1668 // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots | 1668 // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots |
1669 // and must be updated if the number of store ics emitted here changes. | 1669 // and must be updated if the number of store ICs emitted here changes. |
1670 int store_slot_index = 0; | 1670 int store_slot_index = 0; |
1671 for (; property_index < expr->properties()->length(); property_index++) { | 1671 for (; property_index < expr->properties()->length(); property_index++) { |
1672 ObjectLiteral::Property* property = expr->properties()->at(property_index); | 1672 ObjectLiteral::Property* property = expr->properties()->at(property_index); |
1673 if (property->is_computed_name()) break; | 1673 if (property->is_computed_name()) break; |
1674 if (property->IsCompileTimeValue()) continue; | 1674 if (property->IsCompileTimeValue()) continue; |
1675 | 1675 |
1676 Literal* key = property->key()->AsLiteral(); | 1676 Literal* key = property->key()->AsLiteral(); |
1677 Expression* value = property->value(); | 1677 Expression* value = property->value(); |
1678 if (!result_saved) { | 1678 if (!result_saved) { |
1679 __ push(v0); // Save result on stack. | 1679 __ push(v0); // Save result on stack. |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2534 DCHECK(lit != NULL); | 2534 DCHECK(lit != NULL); |
2535 __ push(v0); | 2535 __ push(v0); |
2536 | 2536 |
2537 // No access check is needed here since the constructor is created by the | 2537 // No access check is needed here since the constructor is created by the |
2538 // class literal. | 2538 // class literal. |
2539 Register scratch = a1; | 2539 Register scratch = a1; |
2540 __ lw(scratch, | 2540 __ lw(scratch, |
2541 FieldMemOperand(v0, JSFunction::kPrototypeOrInitialMapOffset)); | 2541 FieldMemOperand(v0, JSFunction::kPrototypeOrInitialMapOffset)); |
2542 __ push(scratch); | 2542 __ push(scratch); |
2543 | 2543 |
| 2544 // store_slot_index points to the vector IC slot for the next store IC used. |
| 2545 // ClassLiteral::ComputeFeedbackRequirements controls the allocation of slots |
| 2546 // and must be updated if the number of store ICs emitted here changes. |
| 2547 int store_slot_index = 0; |
2544 for (int i = 0; i < lit->properties()->length(); i++) { | 2548 for (int i = 0; i < lit->properties()->length(); i++) { |
2545 ObjectLiteral::Property* property = lit->properties()->at(i); | 2549 ObjectLiteral::Property* property = lit->properties()->at(i); |
2546 Expression* value = property->value(); | 2550 Expression* value = property->value(); |
2547 | 2551 |
2548 if (property->is_static()) { | 2552 if (property->is_static()) { |
2549 __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor | 2553 __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor |
2550 } else { | 2554 } else { |
2551 __ lw(scratch, MemOperand(sp, 0)); // prototype | 2555 __ lw(scratch, MemOperand(sp, 0)); // prototype |
2552 } | 2556 } |
2553 __ push(scratch); | 2557 __ push(scratch); |
2554 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2558 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
2555 | 2559 |
2556 // The static prototype property is read only. We handle the non computed | 2560 // The static prototype property is read only. We handle the non computed |
2557 // property name case in the parser. Since this is the only case where we | 2561 // property name case in the parser. Since this is the only case where we |
2558 // need to check for an own read only property we special case this so we do | 2562 // need to check for an own read only property we special case this so we do |
2559 // not need to do this for every property. | 2563 // not need to do this for every property. |
2560 if (property->is_static() && property->is_computed_name()) { | 2564 if (property->is_static() && property->is_computed_name()) { |
2561 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); | 2565 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); |
2562 __ push(v0); | 2566 __ push(v0); |
2563 } | 2567 } |
2564 | 2568 |
2565 VisitForStackValue(value); | 2569 VisitForStackValue(value); |
2566 EmitSetHomeObjectIfNeeded(value, 2); | 2570 EmitSetHomeObjectIfNeeded(value, 2, |
| 2571 lit->SlotForHomeObject(value, &store_slot_index)); |
2567 | 2572 |
2568 switch (property->kind()) { | 2573 switch (property->kind()) { |
2569 case ObjectLiteral::Property::CONSTANT: | 2574 case ObjectLiteral::Property::CONSTANT: |
2570 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2575 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
2571 case ObjectLiteral::Property::PROTOTYPE: | 2576 case ObjectLiteral::Property::PROTOTYPE: |
2572 UNREACHABLE(); | 2577 UNREACHABLE(); |
2573 case ObjectLiteral::Property::COMPUTED: | 2578 case ObjectLiteral::Property::COMPUTED: |
2574 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2579 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
2575 break; | 2580 break; |
2576 | 2581 |
(...skipping 12 matching lines...) Expand all Loading... |
2589 default: | 2594 default: |
2590 UNREACHABLE(); | 2595 UNREACHABLE(); |
2591 } | 2596 } |
2592 } | 2597 } |
2593 | 2598 |
2594 // prototype | 2599 // prototype |
2595 __ CallRuntime(Runtime::kToFastProperties, 1); | 2600 __ CallRuntime(Runtime::kToFastProperties, 1); |
2596 | 2601 |
2597 // constructor | 2602 // constructor |
2598 __ CallRuntime(Runtime::kToFastProperties, 1); | 2603 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2604 |
| 2605 // Verify that compilation exactly consumed the number of store ic slots that |
| 2606 // the ClassLiteral node had to offer. |
| 2607 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); |
2599 } | 2608 } |
2600 | 2609 |
2601 | 2610 |
2602 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2611 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2603 __ mov(a0, result_register()); | 2612 __ mov(a0, result_register()); |
2604 __ pop(a1); | 2613 __ pop(a1); |
2605 Handle<Code> code = CodeFactory::BinaryOpIC( | 2614 Handle<Code> code = CodeFactory::BinaryOpIC( |
2606 isolate(), op, language_mode()).code(); | 2615 isolate(), op, language_mode()).code(); |
2607 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2616 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2608 CallIC(code, expr->BinaryOperationFeedbackId()); | 2617 CallIC(code, expr->BinaryOperationFeedbackId()); |
(...skipping 2931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5540 reinterpret_cast<uint32_t>( | 5549 reinterpret_cast<uint32_t>( |
5541 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5550 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5542 return OSR_AFTER_STACK_CHECK; | 5551 return OSR_AFTER_STACK_CHECK; |
5543 } | 5552 } |
5544 | 5553 |
5545 | 5554 |
5546 } // namespace internal | 5555 } // namespace internal |
5547 } // namespace v8 | 5556 } // namespace v8 |
5548 | 5557 |
5549 #endif // V8_TARGET_ARCH_MIPS | 5558 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |