| 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 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 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 __ CallStub(&stub); | 1637 __ CallStub(&stub); |
| 1638 } | 1638 } |
| 1639 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); | 1639 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
| 1640 | 1640 |
| 1641 // If result_saved is true the result is on top of the stack. If | 1641 // If result_saved is true the result is on top of the stack. If |
| 1642 // result_saved is false the result is in rax. | 1642 // result_saved is false the result is in rax. |
| 1643 bool result_saved = false; | 1643 bool result_saved = false; |
| 1644 | 1644 |
| 1645 AccessorTable accessor_table(zone()); | 1645 AccessorTable accessor_table(zone()); |
| 1646 int property_index = 0; | 1646 int property_index = 0; |
| 1647 // store_slot_index points to the vector ic slot for the next store ic used. | 1647 // store_slot_index points to the vector IC slot for the next store IC used. |
| 1648 // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots | 1648 // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots |
| 1649 // and must be updated if the number of store ics emitted here changes. | 1649 // and must be updated if the number of store ICs emitted here changes. |
| 1650 int store_slot_index = 0; | 1650 int store_slot_index = 0; |
| 1651 for (; property_index < expr->properties()->length(); property_index++) { | 1651 for (; property_index < expr->properties()->length(); property_index++) { |
| 1652 ObjectLiteral::Property* property = expr->properties()->at(property_index); | 1652 ObjectLiteral::Property* property = expr->properties()->at(property_index); |
| 1653 if (property->is_computed_name()) break; | 1653 if (property->is_computed_name()) break; |
| 1654 if (property->IsCompileTimeValue()) continue; | 1654 if (property->IsCompileTimeValue()) continue; |
| 1655 | 1655 |
| 1656 Literal* key = property->key()->AsLiteral(); | 1656 Literal* key = property->key()->AsLiteral(); |
| 1657 Expression* value = property->value(); | 1657 Expression* value = property->value(); |
| 1658 if (!result_saved) { | 1658 if (!result_saved) { |
| 1659 __ Push(rax); // Save result on the stack | 1659 __ Push(rax); // Save result on the stack |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2465 // Constructor is in rax. | 2465 // Constructor is in rax. |
| 2466 DCHECK(lit != NULL); | 2466 DCHECK(lit != NULL); |
| 2467 __ Push(rax); | 2467 __ Push(rax); |
| 2468 | 2468 |
| 2469 // No access check is needed here since the constructor is created by the | 2469 // No access check is needed here since the constructor is created by the |
| 2470 // class literal. | 2470 // class literal. |
| 2471 Register scratch = rbx; | 2471 Register scratch = rbx; |
| 2472 __ movp(scratch, FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset)); | 2472 __ movp(scratch, FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset)); |
| 2473 __ Push(scratch); | 2473 __ Push(scratch); |
| 2474 | 2474 |
| 2475 // store_slot_index points to the vector IC slot for the next store IC used. |
| 2476 // ClassLiteral::ComputeFeedbackRequirements controls the allocation of slots |
| 2477 // and must be updated if the number of store ICs emitted here changes. |
| 2478 int store_slot_index = 0; |
| 2475 for (int i = 0; i < lit->properties()->length(); i++) { | 2479 for (int i = 0; i < lit->properties()->length(); i++) { |
| 2476 ObjectLiteral::Property* property = lit->properties()->at(i); | 2480 ObjectLiteral::Property* property = lit->properties()->at(i); |
| 2477 Expression* value = property->value(); | 2481 Expression* value = property->value(); |
| 2478 | 2482 |
| 2479 if (property->is_static()) { | 2483 if (property->is_static()) { |
| 2480 __ Push(Operand(rsp, kPointerSize)); // constructor | 2484 __ Push(Operand(rsp, kPointerSize)); // constructor |
| 2481 } else { | 2485 } else { |
| 2482 __ Push(Operand(rsp, 0)); // prototype | 2486 __ Push(Operand(rsp, 0)); // prototype |
| 2483 } | 2487 } |
| 2484 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2488 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
| 2485 | 2489 |
| 2486 // The static prototype property is read only. We handle the non computed | 2490 // The static prototype property is read only. We handle the non computed |
| 2487 // property name case in the parser. Since this is the only case where we | 2491 // property name case in the parser. Since this is the only case where we |
| 2488 // need to check for an own read only property we special case this so we do | 2492 // need to check for an own read only property we special case this so we do |
| 2489 // not need to do this for every property. | 2493 // not need to do this for every property. |
| 2490 if (property->is_static() && property->is_computed_name()) { | 2494 if (property->is_static() && property->is_computed_name()) { |
| 2491 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); | 2495 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); |
| 2492 __ Push(rax); | 2496 __ Push(rax); |
| 2493 } | 2497 } |
| 2494 | 2498 |
| 2495 VisitForStackValue(value); | 2499 VisitForStackValue(value); |
| 2496 EmitSetHomeObjectIfNeeded(value, 2); | 2500 EmitSetHomeObjectIfNeeded(value, 2, |
| 2501 lit->SlotForHomeObject(value, &store_slot_index)); |
| 2497 | 2502 |
| 2498 switch (property->kind()) { | 2503 switch (property->kind()) { |
| 2499 case ObjectLiteral::Property::CONSTANT: | 2504 case ObjectLiteral::Property::CONSTANT: |
| 2500 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2505 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| 2501 case ObjectLiteral::Property::PROTOTYPE: | 2506 case ObjectLiteral::Property::PROTOTYPE: |
| 2502 UNREACHABLE(); | 2507 UNREACHABLE(); |
| 2503 case ObjectLiteral::Property::COMPUTED: | 2508 case ObjectLiteral::Property::COMPUTED: |
| 2504 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2509 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
| 2505 break; | 2510 break; |
| 2506 | 2511 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2517 default: | 2522 default: |
| 2518 UNREACHABLE(); | 2523 UNREACHABLE(); |
| 2519 } | 2524 } |
| 2520 } | 2525 } |
| 2521 | 2526 |
| 2522 // prototype | 2527 // prototype |
| 2523 __ CallRuntime(Runtime::kToFastProperties, 1); | 2528 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2524 | 2529 |
| 2525 // constructor | 2530 // constructor |
| 2526 __ CallRuntime(Runtime::kToFastProperties, 1); | 2531 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2532 |
| 2533 // Verify that compilation exactly consumed the number of store ic slots that |
| 2534 // the ClassLiteral node had to offer. |
| 2535 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); |
| 2527 } | 2536 } |
| 2528 | 2537 |
| 2529 | 2538 |
| 2530 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2539 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
| 2531 __ Pop(rdx); | 2540 __ Pop(rdx); |
| 2532 Handle<Code> code = CodeFactory::BinaryOpIC( | 2541 Handle<Code> code = CodeFactory::BinaryOpIC( |
| 2533 isolate(), op, language_mode()).code(); | 2542 isolate(), op, language_mode()).code(); |
| 2534 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2543 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2535 CallIC(code, expr->BinaryOperationFeedbackId()); | 2544 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2536 patch_site.EmitPatchInfo(); | 2545 patch_site.EmitPatchInfo(); |
| (...skipping 2944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5481 Assembler::target_address_at(call_target_address, | 5490 Assembler::target_address_at(call_target_address, |
| 5482 unoptimized_code)); | 5491 unoptimized_code)); |
| 5483 return OSR_AFTER_STACK_CHECK; | 5492 return OSR_AFTER_STACK_CHECK; |
| 5484 } | 5493 } |
| 5485 | 5494 |
| 5486 | 5495 |
| 5487 } // namespace internal | 5496 } // namespace internal |
| 5488 } // namespace v8 | 5497 } // namespace v8 |
| 5489 | 5498 |
| 5490 #endif // V8_TARGET_ARCH_X64 | 5499 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |