OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 10392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10403 | 10403 |
10404 | 10404 |
10405 void HOptimizedGraphBuilder::VisitDelete(UnaryOperation* expr) { | 10405 void HOptimizedGraphBuilder::VisitDelete(UnaryOperation* expr) { |
10406 Property* prop = expr->expression()->AsProperty(); | 10406 Property* prop = expr->expression()->AsProperty(); |
10407 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 10407 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
10408 if (prop != NULL) { | 10408 if (prop != NULL) { |
10409 CHECK_ALIVE(VisitForValue(prop->obj())); | 10409 CHECK_ALIVE(VisitForValue(prop->obj())); |
10410 CHECK_ALIVE(VisitForValue(prop->key())); | 10410 CHECK_ALIVE(VisitForValue(prop->key())); |
10411 HValue* key = Pop(); | 10411 HValue* key = Pop(); |
10412 HValue* obj = Pop(); | 10412 HValue* obj = Pop(); |
10413 HValue* function = AddLoadJSBuiltin(Builtins::DELETE); | 10413 Add<HPushArguments>(obj, key); |
10414 Add<HPushArguments>(obj, key, Add<HConstant>(function_language_mode())); | 10414 HInstruction* instr = New<HCallRuntime>( |
10415 // TODO(olivf) InvokeFunction produces a check for the parameter count, | 10415 isolate()->factory()->empty_string(), |
10416 // even though we are certain to pass the correct number of arguments here. | 10416 Runtime::FunctionForId(is_strict(function_language_mode()) |
10417 HInstruction* instr = New<HInvokeFunction>(function, 3); | 10417 ? Runtime::kDeleteProperty_Strict |
| 10418 : Runtime::kDeleteProperty_Sloppy), |
| 10419 2); |
10418 return ast_context()->ReturnInstruction(instr, expr->id()); | 10420 return ast_context()->ReturnInstruction(instr, expr->id()); |
10419 } else if (proxy != NULL) { | 10421 } else if (proxy != NULL) { |
10420 Variable* var = proxy->var(); | 10422 Variable* var = proxy->var(); |
10421 if (var->IsUnallocatedOrGlobalSlot()) { | 10423 if (var->IsUnallocatedOrGlobalSlot()) { |
10422 Bailout(kDeleteWithGlobalVariable); | 10424 Bailout(kDeleteWithGlobalVariable); |
10423 } else if (var->IsStackAllocated() || var->IsContextSlot()) { | 10425 } else if (var->IsStackAllocated() || var->IsContextSlot()) { |
10424 // Result of deleting non-global variables is false. 'this' is not really | 10426 // Result of deleting non-global variables is false. 'this' is not really |
10425 // a variable, though we implement it as one. The subexpression does not | 10427 // a variable, though we implement it as one. The subexpression does not |
10426 // have side effects. | 10428 // have side effects. |
10427 HValue* value = var->HasThisName(isolate()) ? graph()->GetConstantTrue() | 10429 HValue* value = var->HasThisName(isolate()) ? graph()->GetConstantTrue() |
(...skipping 3007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13435 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13437 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13436 } | 13438 } |
13437 | 13439 |
13438 #ifdef DEBUG | 13440 #ifdef DEBUG |
13439 graph_->Verify(false); // No full verify. | 13441 graph_->Verify(false); // No full verify. |
13440 #endif | 13442 #endif |
13441 } | 13443 } |
13442 | 13444 |
13443 } // namespace internal | 13445 } // namespace internal |
13444 } // namespace v8 | 13446 } // namespace v8 |
OLD | NEW |