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