| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2541 break; | 2541 break; |
| 2542 default: | 2542 default: |
| 2543 UNREACHABLE(); | 2543 UNREACHABLE(); |
| 2544 } | 2544 } |
| 2545 | 2545 |
| 2546 __ bind(&done); | 2546 __ bind(&done); |
| 2547 context()->Plug(r3); | 2547 context()->Plug(r3); |
| 2548 } | 2548 } |
| 2549 | 2549 |
| 2550 | 2550 |
| 2551 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | 2551 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit, |
| 2552 int* used_store_slots) { |
| 2552 // Constructor is in r3. | 2553 // Constructor is in r3. |
| 2553 DCHECK(lit != NULL); | 2554 DCHECK(lit != NULL); |
| 2554 __ push(r3); | 2555 __ push(r3); |
| 2555 | 2556 |
| 2556 // No access check is needed here since the constructor is created by the | 2557 // No access check is needed here since the constructor is created by the |
| 2557 // class literal. | 2558 // class literal. |
| 2558 Register scratch = r4; | 2559 Register scratch = r4; |
| 2559 __ LoadP(scratch, | 2560 __ LoadP(scratch, |
| 2560 FieldMemOperand(r3, JSFunction::kPrototypeOrInitialMapOffset)); | 2561 FieldMemOperand(r3, JSFunction::kPrototypeOrInitialMapOffset)); |
| 2561 __ push(scratch); | 2562 __ push(scratch); |
| 2562 | 2563 |
| 2563 // store_slot_index points to the vector IC slot for the next store IC used. | |
| 2564 // ClassLiteral::ComputeFeedbackRequirements controls the allocation of slots | |
| 2565 // and must be updated if the number of store ICs emitted here changes. | |
| 2566 int store_slot_index = 0; | |
| 2567 for (int i = 0; i < lit->properties()->length(); i++) { | 2564 for (int i = 0; i < lit->properties()->length(); i++) { |
| 2568 ObjectLiteral::Property* property = lit->properties()->at(i); | 2565 ObjectLiteral::Property* property = lit->properties()->at(i); |
| 2569 Expression* value = property->value(); | 2566 Expression* value = property->value(); |
| 2570 | 2567 |
| 2571 if (property->is_static()) { | 2568 if (property->is_static()) { |
| 2572 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // constructor | 2569 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // constructor |
| 2573 } else { | 2570 } else { |
| 2574 __ LoadP(scratch, MemOperand(sp, 0)); // prototype | 2571 __ LoadP(scratch, MemOperand(sp, 0)); // prototype |
| 2575 } | 2572 } |
| 2576 __ push(scratch); | 2573 __ push(scratch); |
| 2577 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2574 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
| 2578 | 2575 |
| 2579 // The static prototype property is read only. We handle the non computed | 2576 // The static prototype property is read only. We handle the non computed |
| 2580 // property name case in the parser. Since this is the only case where we | 2577 // property name case in the parser. Since this is the only case where we |
| 2581 // need to check for an own read only property we special case this so we do | 2578 // need to check for an own read only property we special case this so we do |
| 2582 // not need to do this for every property. | 2579 // not need to do this for every property. |
| 2583 if (property->is_static() && property->is_computed_name()) { | 2580 if (property->is_static() && property->is_computed_name()) { |
| 2584 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); | 2581 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); |
| 2585 __ push(r3); | 2582 __ push(r3); |
| 2586 } | 2583 } |
| 2587 | 2584 |
| 2588 VisitForStackValue(value); | 2585 VisitForStackValue(value); |
| 2589 EmitSetHomeObjectIfNeeded(value, 2, | 2586 EmitSetHomeObjectIfNeeded(value, 2, |
| 2590 lit->SlotForHomeObject(value, &store_slot_index)); | 2587 lit->SlotForHomeObject(value, used_store_slots)); |
| 2591 | 2588 |
| 2592 switch (property->kind()) { | 2589 switch (property->kind()) { |
| 2593 case ObjectLiteral::Property::CONSTANT: | 2590 case ObjectLiteral::Property::CONSTANT: |
| 2594 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2591 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| 2595 case ObjectLiteral::Property::PROTOTYPE: | 2592 case ObjectLiteral::Property::PROTOTYPE: |
| 2596 UNREACHABLE(); | 2593 UNREACHABLE(); |
| 2597 case ObjectLiteral::Property::COMPUTED: | 2594 case ObjectLiteral::Property::COMPUTED: |
| 2598 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2595 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
| 2599 break; | 2596 break; |
| 2600 | 2597 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2613 default: | 2610 default: |
| 2614 UNREACHABLE(); | 2611 UNREACHABLE(); |
| 2615 } | 2612 } |
| 2616 } | 2613 } |
| 2617 | 2614 |
| 2618 // prototype | 2615 // prototype |
| 2619 __ CallRuntime(Runtime::kToFastProperties, 1); | 2616 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2620 | 2617 |
| 2621 // constructor | 2618 // constructor |
| 2622 __ CallRuntime(Runtime::kToFastProperties, 1); | 2619 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2623 | |
| 2624 // Verify that compilation exactly consumed the number of store ic slots that | |
| 2625 // the ClassLiteral node had to offer. | |
| 2626 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); | |
| 2627 } | 2620 } |
| 2628 | 2621 |
| 2629 | 2622 |
| 2630 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2623 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
| 2631 __ pop(r4); | 2624 __ pop(r4); |
| 2632 Handle<Code> code = | 2625 Handle<Code> code = |
| 2633 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); | 2626 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
| 2634 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2627 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2635 CallIC(code, expr->BinaryOperationFeedbackId()); | 2628 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2636 patch_site.EmitPatchInfo(); | 2629 patch_site.EmitPatchInfo(); |
| (...skipping 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5567 return ON_STACK_REPLACEMENT; | 5560 return ON_STACK_REPLACEMENT; |
| 5568 } | 5561 } |
| 5569 | 5562 |
| 5570 DCHECK(interrupt_address == | 5563 DCHECK(interrupt_address == |
| 5571 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5564 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5572 return OSR_AFTER_STACK_CHECK; | 5565 return OSR_AFTER_STACK_CHECK; |
| 5573 } | 5566 } |
| 5574 } // namespace internal | 5567 } // namespace internal |
| 5575 } // namespace v8 | 5568 } // namespace v8 |
| 5576 #endif // V8_TARGET_ARCH_PPC | 5569 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |