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

Side by Side Diff: src/hydrogen.cc

Issue 18357004: Revert r15419: "Generate StoreGlobal stubs with Hydrogen" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution. 11 // with the distribution.
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 #define DEFINE_GET_CONSTANT(Name, name, htype, boolean_value) \ 639 #define DEFINE_GET_CONSTANT(Name, name, htype, boolean_value) \
640 HConstant* HGraph::GetConstant##Name() { \ 640 HConstant* HGraph::GetConstant##Name() { \
641 if (!constant_##name##_.is_set()) { \ 641 if (!constant_##name##_.is_set()) { \
642 HConstant* constant = new(zone()) HConstant( \ 642 HConstant* constant = new(zone()) HConstant( \
643 isolate()->factory()->name##_value(), \ 643 isolate()->factory()->name##_value(), \
644 UniqueValueId(isolate()->heap()->name##_value()), \ 644 UniqueValueId(isolate()->heap()->name##_value()), \
645 Representation::Tagged(), \ 645 Representation::Tagged(), \
646 htype, \ 646 htype, \
647 false, \ 647 false, \
648 true, \ 648 true, \
649 false, \
650 boolean_value); \ 649 boolean_value); \
651 constant->InsertAfter(GetConstantUndefined()); \ 650 constant->InsertAfter(GetConstantUndefined()); \
652 constant_##name##_.set(constant); \ 651 constant_##name##_.set(constant); \
653 } \ 652 } \
654 return constant_##name##_.get(); \ 653 return constant_##name##_.get(); \
655 } 654 }
656 655
657 656
658 DEFINE_GET_CONSTANT(True, true, HType::Boolean(), true) 657 DEFINE_GET_CONSTANT(True, true, HType::Boolean(), true)
659 DEFINE_GET_CONSTANT(False, false, HType::Boolean(), false) 658 DEFINE_GET_CONSTANT(False, false, HType::Boolean(), false)
660 DEFINE_GET_CONSTANT(Hole, the_hole, HType::Tagged(), false) 659 DEFINE_GET_CONSTANT(Hole, the_hole, HType::Tagged(), false)
661 DEFINE_GET_CONSTANT(Null, null, HType::Tagged(), false) 660 DEFINE_GET_CONSTANT(Null, null, HType::Tagged(), false)
662 661
663 662
664 #undef DEFINE_GET_CONSTANT 663 #undef DEFINE_GET_CONSTANT
665 664
666 665
667 HConstant* HGraph::GetInvalidContext() { 666 HConstant* HGraph::GetInvalidContext() {
668 return GetConstant(&constant_invalid_context_, 0xFFFFC0C7); 667 return GetConstant(&constant_invalid_context_, 0xFFFFC0C7);
669 } 668 }
670 669
671 670
672 bool HGraph::IsStandardConstant(HConstant* constant) {
673 if (constant == GetConstantUndefined()) return true;
674 if (constant == GetConstant0()) return true;
675 if (constant == GetConstant1()) return true;
676 if (constant == GetConstantMinus1()) return true;
677 if (constant == GetConstantTrue()) return true;
678 if (constant == GetConstantFalse()) return true;
679 if (constant == GetConstantHole()) return true;
680 if (constant == GetConstantNull()) return true;
681 return false;
682 }
683
684
685 HGraphBuilder::IfBuilder::IfBuilder(HGraphBuilder* builder, int position) 671 HGraphBuilder::IfBuilder::IfBuilder(HGraphBuilder* builder, int position)
686 : builder_(builder), 672 : builder_(builder),
687 position_(position), 673 position_(position),
688 finished_(false), 674 finished_(false),
689 did_then_(false), 675 did_then_(false),
690 did_else_(false), 676 did_else_(false),
691 did_and_(false), 677 did_and_(false),
692 did_or_(false), 678 did_or_(false),
693 captured_(false), 679 captured_(false),
694 needs_compare_(true), 680 needs_compare_(true),
(...skipping 3759 matching lines...) Expand 10 before | Expand all | Expand 10 after
4454 } 4440 }
4455 } 4441 }
4456 4442
4457 4443
4458 void HOptimizedGraphBuilder::PushAndAdd(HInstruction* instr) { 4444 void HOptimizedGraphBuilder::PushAndAdd(HInstruction* instr) {
4459 Push(instr); 4445 Push(instr);
4460 AddInstruction(instr); 4446 AddInstruction(instr);
4461 } 4447 }
4462 4448
4463 4449
4464 void HOptimizedGraphBuilder::AddSoftDeoptimize(SoftDeoptimizeMode mode) { 4450 void HOptimizedGraphBuilder::AddSoftDeoptimize() {
4465 isolate()->counters()->soft_deopts_requested()->Increment(); 4451 isolate()->counters()->soft_deopts_requested()->Increment();
4466 if (FLAG_always_opt && mode == CAN_OMIT_SOFT_DEOPT) return; 4452 if (FLAG_always_opt) return;
4467 if (current_block()->IsDeoptimizing()) return; 4453 if (current_block()->IsDeoptimizing()) return;
4468 Add<HSoftDeoptimize>(); 4454 Add<HSoftDeoptimize>();
4469 isolate()->counters()->soft_deopts_inserted()->Increment(); 4455 isolate()->counters()->soft_deopts_inserted()->Increment();
4470 current_block()->MarkAsDeoptimizing(); 4456 current_block()->MarkAsDeoptimizing();
4471 graph()->set_has_soft_deoptimize(true); 4457 graph()->set_has_soft_deoptimize(true);
4472 } 4458 }
4473 4459
4474 4460
4475 template <class Instruction> 4461 template <class Instruction>
4476 HInstruction* HOptimizedGraphBuilder::PreProcessCall(Instruction* call) { 4462 HInstruction* HOptimizedGraphBuilder::PreProcessCall(Instruction* call) {
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
5409 LookupGlobalProperty(variable, &lookup, false); 5395 LookupGlobalProperty(variable, &lookup, false);
5410 5396
5411 if (type == kUseCell && 5397 if (type == kUseCell &&
5412 current_info()->global_object()->IsAccessCheckNeeded()) { 5398 current_info()->global_object()->IsAccessCheckNeeded()) {
5413 type = kUseGeneric; 5399 type = kUseGeneric;
5414 } 5400 }
5415 5401
5416 if (type == kUseCell) { 5402 if (type == kUseCell) {
5417 Handle<GlobalObject> global(current_info()->global_object()); 5403 Handle<GlobalObject> global(current_info()->global_object());
5418 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); 5404 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup));
5419 if (cell->type()->IsConstant()) { 5405 HLoadGlobalCell* instr =
5420 cell->AddDependentCompilationInfo(top_info()); 5406 new(zone()) HLoadGlobalCell(cell, lookup.GetPropertyDetails());
5421 Handle<Object> constant_object = cell->type()->AsConstant(); 5407 return ast_context()->ReturnInstruction(instr, expr->id());
5422 if (constant_object->IsConsString()) {
5423 constant_object =
5424 FlattenGetString(Handle<String>::cast(constant_object));
5425 }
5426 HConstant* constant = new(zone()) HConstant(constant_object);
5427 return ast_context()->ReturnInstruction(constant, expr->id());
5428 } else {
5429 HLoadGlobalCell* instr =
5430 new(zone()) HLoadGlobalCell(cell, lookup.GetPropertyDetails());
5431 return ast_context()->ReturnInstruction(instr, expr->id());
5432 }
5433 } else { 5408 } else {
5434 HValue* context = environment()->LookupContext(); 5409 HValue* context = environment()->LookupContext();
5435 HGlobalObject* global_object = new(zone()) HGlobalObject(context); 5410 HGlobalObject* global_object = new(zone()) HGlobalObject(context);
5436 AddInstruction(global_object); 5411 AddInstruction(global_object);
5437 HLoadGlobalGeneric* instr = 5412 HLoadGlobalGeneric* instr =
5438 new(zone()) HLoadGlobalGeneric(context, 5413 new(zone()) HLoadGlobalGeneric(context,
5439 global_object, 5414 global_object,
5440 variable->name(), 5415 variable->name(),
5441 ast_context()->is_for_typeof()); 5416 ast_context()->is_for_typeof());
5442 instr->set_position(expr->position()); 5417 instr->set_position(expr->position());
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
6329 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( 6304 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
6330 Variable* var, 6305 Variable* var,
6331 HValue* value, 6306 HValue* value,
6332 int position, 6307 int position,
6333 BailoutId ast_id) { 6308 BailoutId ast_id) {
6334 LookupResult lookup(isolate()); 6309 LookupResult lookup(isolate());
6335 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, true); 6310 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, true);
6336 if (type == kUseCell) { 6311 if (type == kUseCell) {
6337 Handle<GlobalObject> global(current_info()->global_object()); 6312 Handle<GlobalObject> global(current_info()->global_object());
6338 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); 6313 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup));
6339 if (cell->type()->IsConstant()) { 6314 HInstruction* instr = Add<HStoreGlobalCell>(value, cell,
6340 IfBuilder builder(this); 6315 lookup.GetPropertyDetails());
6341 HValue* constant = Add<HConstant>(cell->type()->AsConstant());
6342 if (cell->type()->AsConstant()->IsNumber()) {
6343 builder.IfCompare(value, constant, Token::EQ);
6344 } else {
6345 builder.If<HCompareObjectEqAndBranch>(value, constant);
6346 }
6347 builder.Then();
6348 builder.Else();
6349 AddSoftDeoptimize(MUST_EMIT_SOFT_DEOPT);
6350 builder.End();
6351 }
6352 HInstruction* instr =
6353 Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails());
6354 instr->set_position(position); 6316 instr->set_position(position);
6355 if (instr->HasObservableSideEffects()) { 6317 if (instr->HasObservableSideEffects()) {
6356 AddSimulate(ast_id, REMOVABLE_SIMULATE); 6318 AddSimulate(ast_id, REMOVABLE_SIMULATE);
6357 } 6319 }
6358 } else { 6320 } else {
6359 HValue* context = environment()->LookupContext(); 6321 HValue* context = environment()->LookupContext();
6360 HGlobalObject* global_object = Add<HGlobalObject>(context); 6322 HGlobalObject* global_object = Add<HGlobalObject>(context);
6361 HStoreGlobalGeneric* instr = 6323 HStoreGlobalGeneric* instr =
6362 Add<HStoreGlobalGeneric>(context, global_object, var->name(), 6324 Add<HStoreGlobalGeneric>(context, global_object, var->name(),
6363 value, function_strict_mode_flag()); 6325 value, function_strict_mode_flag());
(...skipping 4918 matching lines...) Expand 10 before | Expand all | Expand 10 after
11282 if (ShouldProduceTraceOutput()) { 11244 if (ShouldProduceTraceOutput()) {
11283 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11245 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11284 } 11246 }
11285 11247
11286 #ifdef DEBUG 11248 #ifdef DEBUG
11287 graph_->Verify(false); // No full verify. 11249 graph_->Verify(false); // No full verify.
11288 #endif 11250 #endif
11289 } 11251 }
11290 11252
11291 } } // namespace v8::internal 11253 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698