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

Side by Side Diff: src/hydrogen.cc

Issue 18154004: Replace custom builtin invocation instructions by a generic version (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase 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 2013 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
(...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 1950
1951 1951
1952 HStoreNamedField* HGraphBuilder::AddStoreMapConstant(HValue *object, 1952 HStoreNamedField* HGraphBuilder::AddStoreMapConstant(HValue *object,
1953 Handle<Map> map) { 1953 Handle<Map> map) {
1954 return Add<HStoreNamedField>(object, HObjectAccess::ForMap(), 1954 return Add<HStoreNamedField>(object, HObjectAccess::ForMap(),
1955 Add<HConstant>(map)); 1955 Add<HConstant>(map));
1956 } 1956 }
1957 1957
1958 1958
1959 HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin, 1959 HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin,
1960 HContext* context) { 1960 HValue* context) {
1961 HGlobalObject* global_object = Add<HGlobalObject>(context); 1961 HGlobalObject* global_object = Add<HGlobalObject>(context);
1962 HObjectAccess access = HObjectAccess::ForJSObjectOffset( 1962 HObjectAccess access = HObjectAccess::ForJSObjectOffset(
1963 GlobalObject::kBuiltinsOffset); 1963 GlobalObject::kBuiltinsOffset);
1964 HValue* builtins = AddLoad(global_object, access); 1964 HValue* builtins = AddLoad(global_object, access);
1965 HObjectAccess function_access = HObjectAccess::ForJSObjectOffset( 1965 HObjectAccess function_access = HObjectAccess::ForJSObjectOffset(
1966 JSBuiltinsObject::OffsetOfFunctionWithId(builtin)); 1966 JSBuiltinsObject::OffsetOfFunctionWithId(builtin));
1967 return AddLoad(builtins, function_access); 1967 return AddLoad(builtins, function_access);
1968 } 1968 }
1969 1969
1970 1970
(...skipping 5650 matching lines...) Expand 10 before | Expand all | Expand 10 after
7621 7621
7622 void HOptimizedGraphBuilder::VisitDelete(UnaryOperation* expr) { 7622 void HOptimizedGraphBuilder::VisitDelete(UnaryOperation* expr) {
7623 Property* prop = expr->expression()->AsProperty(); 7623 Property* prop = expr->expression()->AsProperty();
7624 VariableProxy* proxy = expr->expression()->AsVariableProxy(); 7624 VariableProxy* proxy = expr->expression()->AsVariableProxy();
7625 if (prop != NULL) { 7625 if (prop != NULL) {
7626 CHECK_ALIVE(VisitForValue(prop->obj())); 7626 CHECK_ALIVE(VisitForValue(prop->obj()));
7627 CHECK_ALIVE(VisitForValue(prop->key())); 7627 CHECK_ALIVE(VisitForValue(prop->key()));
7628 HValue* key = Pop(); 7628 HValue* key = Pop();
7629 HValue* obj = Pop(); 7629 HValue* obj = Pop();
7630 HValue* context = environment()->LookupContext(); 7630 HValue* context = environment()->LookupContext();
7631 HDeleteProperty* instr = new(zone()) HDeleteProperty(context, obj, key); 7631 HValue* function = AddLoadJSBuiltin(Builtins::DELETE, context);
7632 Add<HPushArgument>(obj);
7633 Add<HPushArgument>(key);
7634 Add<HPushArgument>(Add<HConstant>(function_strict_mode_flag()));
7635 // TODO(olivf) InvokeFunction produces a check for the parameter count,
7636 // even though we are certain to pass the correct number of arguments here.
7637 HInstruction* instr = new(zone()) HInvokeFunction(context, function, 3);
7632 return ast_context()->ReturnInstruction(instr, expr->id()); 7638 return ast_context()->ReturnInstruction(instr, expr->id());
7633 } else if (proxy != NULL) { 7639 } else if (proxy != NULL) {
7634 Variable* var = proxy->var(); 7640 Variable* var = proxy->var();
7635 if (var->IsUnallocated()) { 7641 if (var->IsUnallocated()) {
7636 Bailout("delete with global variable"); 7642 Bailout("delete with global variable");
7637 } else if (var->IsStackAllocated() || var->IsContextSlot()) { 7643 } else if (var->IsStackAllocated() || var->IsContextSlot()) {
7638 // Result of deleting non-global variables is false. 'this' is not 7644 // Result of deleting non-global variables is false. 'this' is not
7639 // really a variable, though we implement it as one. The 7645 // really a variable, though we implement it as one. The
7640 // subexpression does not have side effects. 7646 // subexpression does not have side effects.
7641 HValue* value = var->is_this() 7647 HValue* value = var->is_this()
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
8434 Add<HCheckFunction>(right, target); 8440 Add<HCheckFunction>(right, target);
8435 HInstanceOfKnownGlobal* result = 8441 HInstanceOfKnownGlobal* result =
8436 new(zone()) HInstanceOfKnownGlobal(context, left, target); 8442 new(zone()) HInstanceOfKnownGlobal(context, left, target);
8437 result->set_position(expr->position()); 8443 result->set_position(expr->position());
8438 return ast_context()->ReturnInstruction(result, expr->id()); 8444 return ast_context()->ReturnInstruction(result, expr->id());
8439 } 8445 }
8440 8446
8441 // Code below assumes that we don't fall through. 8447 // Code below assumes that we don't fall through.
8442 UNREACHABLE(); 8448 UNREACHABLE();
8443 } else if (op == Token::IN) { 8449 } else if (op == Token::IN) {
8444 HIn* result = new(zone()) HIn(context, left, right); 8450 HValue* function = AddLoadJSBuiltin(Builtins::IN, context);
8451 Add<HPushArgument>(left);
8452 Add<HPushArgument>(right);
8453 // TODO(olivf) InvokeFunction produces a check for the parameter count,
8454 // even though we are certain to pass the correct number of arguments here.
8455 HInstruction* result = new(zone()) HInvokeFunction(context, function, 2);
8445 result->set_position(expr->position()); 8456 result->set_position(expr->position());
8446 return ast_context()->ReturnInstruction(result, expr->id()); 8457 return ast_context()->ReturnInstruction(result, expr->id());
8447 } 8458 }
8448 8459
8449 // Cases handled below depend on collected type feedback. They should 8460 // Cases handled below depend on collected type feedback. They should
8450 // soft deoptimize when there is no type feedback. 8461 // soft deoptimize when there is no type feedback.
8451 if (combined_type->Is(Type::None())) { 8462 if (combined_type->Is(Type::None())) {
8452 AddSoftDeoptimize(); 8463 AddSoftDeoptimize();
8453 combined_type = left_type = right_type = handle(Type::Any(), isolate()); 8464 combined_type = left_type = right_type = handle(Type::Any(), isolate());
8454 } 8465 }
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after
10176 if (ShouldProduceTraceOutput()) { 10187 if (ShouldProduceTraceOutput()) {
10177 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10188 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10178 } 10189 }
10179 10190
10180 #ifdef DEBUG 10191 #ifdef DEBUG
10181 graph_->Verify(false); // No full verify. 10192 graph_->Verify(false); // No full verify.
10182 #endif 10193 #endif
10183 } 10194 }
10184 10195
10185 } } // namespace v8::internal 10196 } } // 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