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_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 2532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2543 break; | 2543 break; |
2544 default: | 2544 default: |
2545 UNREACHABLE(); | 2545 UNREACHABLE(); |
2546 } | 2546 } |
2547 | 2547 |
2548 __ bind(&done); | 2548 __ bind(&done); |
2549 context()->Plug(r0); | 2549 context()->Plug(r0); |
2550 } | 2550 } |
2551 | 2551 |
2552 | 2552 |
2553 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | 2553 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit, |
| 2554 int* used_store_slots) { |
2554 // Constructor is in r0. | 2555 // Constructor is in r0. |
2555 DCHECK(lit != NULL); | 2556 DCHECK(lit != NULL); |
2556 __ push(r0); | 2557 __ push(r0); |
2557 | 2558 |
2558 // No access check is needed here since the constructor is created by the | 2559 // No access check is needed here since the constructor is created by the |
2559 // class literal. | 2560 // class literal. |
2560 Register scratch = r1; | 2561 Register scratch = r1; |
2561 __ ldr(scratch, | 2562 __ ldr(scratch, |
2562 FieldMemOperand(r0, JSFunction::kPrototypeOrInitialMapOffset)); | 2563 FieldMemOperand(r0, JSFunction::kPrototypeOrInitialMapOffset)); |
2563 __ push(scratch); | 2564 __ push(scratch); |
2564 | 2565 |
2565 // store_slot_index points to the vector IC slot for the next store IC used. | |
2566 // ClassLiteral::ComputeFeedbackRequirements controls the allocation of slots | |
2567 // and must be updated if the number of store ICs emitted here changes. | |
2568 int store_slot_index = 0; | |
2569 for (int i = 0; i < lit->properties()->length(); i++) { | 2566 for (int i = 0; i < lit->properties()->length(); i++) { |
2570 ObjectLiteral::Property* property = lit->properties()->at(i); | 2567 ObjectLiteral::Property* property = lit->properties()->at(i); |
2571 Expression* value = property->value(); | 2568 Expression* value = property->value(); |
2572 | 2569 |
2573 if (property->is_static()) { | 2570 if (property->is_static()) { |
2574 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor | 2571 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor |
2575 } else { | 2572 } else { |
2576 __ ldr(scratch, MemOperand(sp, 0)); // prototype | 2573 __ ldr(scratch, MemOperand(sp, 0)); // prototype |
2577 } | 2574 } |
2578 __ push(scratch); | 2575 __ push(scratch); |
2579 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2576 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
2580 | 2577 |
2581 // The static prototype property is read only. We handle the non computed | 2578 // The static prototype property is read only. We handle the non computed |
2582 // property name case in the parser. Since this is the only case where we | 2579 // property name case in the parser. Since this is the only case where we |
2583 // need to check for an own read only property we special case this so we do | 2580 // need to check for an own read only property we special case this so we do |
2584 // not need to do this for every property. | 2581 // not need to do this for every property. |
2585 if (property->is_static() && property->is_computed_name()) { | 2582 if (property->is_static() && property->is_computed_name()) { |
2586 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); | 2583 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); |
2587 __ push(r0); | 2584 __ push(r0); |
2588 } | 2585 } |
2589 | 2586 |
2590 VisitForStackValue(value); | 2587 VisitForStackValue(value); |
2591 EmitSetHomeObjectIfNeeded(value, 2, | 2588 EmitSetHomeObjectIfNeeded(value, 2, |
2592 lit->SlotForHomeObject(value, &store_slot_index)); | 2589 lit->SlotForHomeObject(value, used_store_slots)); |
2593 | 2590 |
2594 switch (property->kind()) { | 2591 switch (property->kind()) { |
2595 case ObjectLiteral::Property::CONSTANT: | 2592 case ObjectLiteral::Property::CONSTANT: |
2596 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2593 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
2597 case ObjectLiteral::Property::PROTOTYPE: | 2594 case ObjectLiteral::Property::PROTOTYPE: |
2598 UNREACHABLE(); | 2595 UNREACHABLE(); |
2599 case ObjectLiteral::Property::COMPUTED: | 2596 case ObjectLiteral::Property::COMPUTED: |
2600 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2597 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
2601 break; | 2598 break; |
2602 | 2599 |
(...skipping 12 matching lines...) Expand all Loading... |
2615 default: | 2612 default: |
2616 UNREACHABLE(); | 2613 UNREACHABLE(); |
2617 } | 2614 } |
2618 } | 2615 } |
2619 | 2616 |
2620 // prototype | 2617 // prototype |
2621 __ CallRuntime(Runtime::kToFastProperties, 1); | 2618 __ CallRuntime(Runtime::kToFastProperties, 1); |
2622 | 2619 |
2623 // constructor | 2620 // constructor |
2624 __ CallRuntime(Runtime::kToFastProperties, 1); | 2621 __ CallRuntime(Runtime::kToFastProperties, 1); |
2625 | |
2626 // Verify that compilation exactly consumed the number of store ic slots that | |
2627 // the ClassLiteral node had to offer. | |
2628 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); | |
2629 } | 2622 } |
2630 | 2623 |
2631 | 2624 |
2632 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2625 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2633 __ pop(r1); | 2626 __ pop(r1); |
2634 Handle<Code> code = | 2627 Handle<Code> code = |
2635 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); | 2628 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
2636 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2629 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2637 CallIC(code, expr->BinaryOperationFeedbackId()); | 2630 CallIC(code, expr->BinaryOperationFeedbackId()); |
2638 patch_site.EmitPatchInfo(); | 2631 patch_site.EmitPatchInfo(); |
(...skipping 2977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5616 DCHECK(interrupt_address == | 5609 DCHECK(interrupt_address == |
5617 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5610 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5618 return OSR_AFTER_STACK_CHECK; | 5611 return OSR_AFTER_STACK_CHECK; |
5619 } | 5612 } |
5620 | 5613 |
5621 | 5614 |
5622 } // namespace internal | 5615 } // namespace internal |
5623 } // namespace v8 | 5616 } // namespace v8 |
5624 | 5617 |
5625 #endif // V8_TARGET_ARCH_ARM | 5618 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |