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