Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: src/x87/full-codegen-x87.cc

Issue 1178533002: X87: Vector ICs: ClassLiterals need to allocate a vector slot for home objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_X87 7 #if V8_TARGET_ARCH_X87
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 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 __ CallStub(&stub); 1599 __ CallStub(&stub);
1600 } 1600 }
1601 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); 1601 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
1602 1602
1603 // If result_saved is true the result is on top of the stack. If 1603 // If result_saved is true the result is on top of the stack. If
1604 // result_saved is false the result is in eax. 1604 // result_saved is false the result is in eax.
1605 bool result_saved = false; 1605 bool result_saved = false;
1606 1606
1607 AccessorTable accessor_table(zone()); 1607 AccessorTable accessor_table(zone());
1608 int property_index = 0; 1608 int property_index = 0;
1609 // store_slot_index points to the vector ic slot for the next store ic used. 1609 // store_slot_index points to the vector IC slot for the next store IC used.
1610 // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots 1610 // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots
1611 // and must be updated if the number of store ics emitted here changes. 1611 // and must be updated if the number of store ICs emitted here changes.
1612 int store_slot_index = 0; 1612 int store_slot_index = 0;
1613 for (; property_index < expr->properties()->length(); property_index++) { 1613 for (; property_index < expr->properties()->length(); property_index++) {
1614 ObjectLiteral::Property* property = expr->properties()->at(property_index); 1614 ObjectLiteral::Property* property = expr->properties()->at(property_index);
1615 if (property->is_computed_name()) break; 1615 if (property->is_computed_name()) break;
1616 if (property->IsCompileTimeValue()) continue; 1616 if (property->IsCompileTimeValue()) continue;
1617 1617
1618 Literal* key = property->key()->AsLiteral(); 1618 Literal* key = property->key()->AsLiteral();
1619 Expression* value = property->value(); 1619 Expression* value = property->value();
1620 if (!result_saved) { 1620 if (!result_saved) {
1621 __ push(eax); // Save result on the stack 1621 __ push(eax); // Save result on the stack
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
2463 // Constructor is in eax. 2463 // Constructor is in eax.
2464 DCHECK(lit != NULL); 2464 DCHECK(lit != NULL);
2465 __ push(eax); 2465 __ push(eax);
2466 2466
2467 // No access check is needed here since the constructor is created by the 2467 // No access check is needed here since the constructor is created by the
2468 // class literal. 2468 // class literal.
2469 Register scratch = ebx; 2469 Register scratch = ebx;
2470 __ mov(scratch, FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset)); 2470 __ mov(scratch, FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset));
2471 __ Push(scratch); 2471 __ Push(scratch);
2472 2472
2473 // store_slot_index points to the vector IC slot for the next store IC used.
2474 // ClassLiteral::ComputeFeedbackRequirements controls the allocation of slots
2475 // and must be updated if the number of store ICs emitted here changes.
2476 int store_slot_index = 0;
2473 for (int i = 0; i < lit->properties()->length(); i++) { 2477 for (int i = 0; i < lit->properties()->length(); i++) {
2474 ObjectLiteral::Property* property = lit->properties()->at(i); 2478 ObjectLiteral::Property* property = lit->properties()->at(i);
2475 Expression* value = property->value(); 2479 Expression* value = property->value();
2476 2480
2477 if (property->is_static()) { 2481 if (property->is_static()) {
2478 __ push(Operand(esp, kPointerSize)); // constructor 2482 __ push(Operand(esp, kPointerSize)); // constructor
2479 } else { 2483 } else {
2480 __ push(Operand(esp, 0)); // prototype 2484 __ push(Operand(esp, 0)); // prototype
2481 } 2485 }
2482 EmitPropertyKey(property, lit->GetIdForProperty(i)); 2486 EmitPropertyKey(property, lit->GetIdForProperty(i));
2483 2487
2484 // The static prototype property is read only. We handle the non computed 2488 // The static prototype property is read only. We handle the non computed
2485 // property name case in the parser. Since this is the only case where we 2489 // property name case in the parser. Since this is the only case where we
2486 // need to check for an own read only property we special case this so we do 2490 // need to check for an own read only property we special case this so we do
2487 // not need to do this for every property. 2491 // not need to do this for every property.
2488 if (property->is_static() && property->is_computed_name()) { 2492 if (property->is_static() && property->is_computed_name()) {
2489 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); 2493 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1);
2490 __ push(eax); 2494 __ push(eax);
2491 } 2495 }
2492 2496
2493 VisitForStackValue(value); 2497 VisitForStackValue(value);
2494 EmitSetHomeObjectIfNeeded(value, 2); 2498 EmitSetHomeObjectIfNeeded(value, 2,
2499 lit->SlotForHomeObject(value, &store_slot_index));
2495 2500
2496 switch (property->kind()) { 2501 switch (property->kind()) {
2497 case ObjectLiteral::Property::CONSTANT: 2502 case ObjectLiteral::Property::CONSTANT:
2498 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 2503 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2499 case ObjectLiteral::Property::PROTOTYPE: 2504 case ObjectLiteral::Property::PROTOTYPE:
2500 UNREACHABLE(); 2505 UNREACHABLE();
2501 case ObjectLiteral::Property::COMPUTED: 2506 case ObjectLiteral::Property::COMPUTED:
2502 __ CallRuntime(Runtime::kDefineClassMethod, 3); 2507 __ CallRuntime(Runtime::kDefineClassMethod, 3);
2503 break; 2508 break;
2504 2509
2505 case ObjectLiteral::Property::GETTER: 2510 case ObjectLiteral::Property::GETTER:
2506 __ push(Immediate(Smi::FromInt(DONT_ENUM))); 2511 __ push(Immediate(Smi::FromInt(DONT_ENUM)));
2507 __ CallRuntime(Runtime::kDefineGetterPropertyUnchecked, 4); 2512 __ CallRuntime(Runtime::kDefineGetterPropertyUnchecked, 4);
2508 break; 2513 break;
2509 2514
2510 case ObjectLiteral::Property::SETTER: 2515 case ObjectLiteral::Property::SETTER:
2511 __ push(Immediate(Smi::FromInt(DONT_ENUM))); 2516 __ push(Immediate(Smi::FromInt(DONT_ENUM)));
2512 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked, 4); 2517 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked, 4);
2513 break; 2518 break;
2514 } 2519 }
2515 } 2520 }
2516 2521
2517 // prototype 2522 // prototype
2518 __ CallRuntime(Runtime::kToFastProperties, 1); 2523 __ CallRuntime(Runtime::kToFastProperties, 1);
2519 2524
2520 // constructor 2525 // constructor
2521 __ CallRuntime(Runtime::kToFastProperties, 1); 2526 __ CallRuntime(Runtime::kToFastProperties, 1);
2527
2528 // Verify that compilation exactly consumed the number of store ic slots that
2529 // the ClassLiteral node had to offer.
2530 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count());
2522 } 2531 }
2523 2532
2524 2533
2525 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 2534 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
2526 __ pop(edx); 2535 __ pop(edx);
2527 Handle<Code> code = 2536 Handle<Code> code =
2528 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); 2537 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code();
2529 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2538 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2530 CallIC(code, expr->BinaryOperationFeedbackId()); 2539 CallIC(code, expr->BinaryOperationFeedbackId());
2531 patch_site.EmitPatchInfo(); 2540 patch_site.EmitPatchInfo();
(...skipping 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after
5437 Assembler::target_address_at(call_target_address, 5446 Assembler::target_address_at(call_target_address,
5438 unoptimized_code)); 5447 unoptimized_code));
5439 return OSR_AFTER_STACK_CHECK; 5448 return OSR_AFTER_STACK_CHECK;
5440 } 5449 }
5441 5450
5442 5451
5443 } // namespace internal 5452 } // namespace internal
5444 } // namespace v8 5453 } // namespace v8
5445 5454
5446 #endif // V8_TARGET_ARCH_X87 5455 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698