OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" |
10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
(...skipping 2921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2932 Visit(stmt->body()); | 2932 Visit(stmt->body()); |
2933 } | 2933 } |
2934 | 2934 |
2935 | 2935 |
2936 void AstGraphBuilder::VisitDelete(UnaryOperation* expr) { | 2936 void AstGraphBuilder::VisitDelete(UnaryOperation* expr) { |
2937 Node* value; | 2937 Node* value; |
2938 if (expr->expression()->IsVariableProxy()) { | 2938 if (expr->expression()->IsVariableProxy()) { |
2939 // Delete of an unqualified identifier is only allowed in classic mode but | 2939 // Delete of an unqualified identifier is only allowed in classic mode but |
2940 // deleting "this" is allowed in all language modes. | 2940 // deleting "this" is allowed in all language modes. |
2941 Variable* variable = expr->expression()->AsVariableProxy()->var(); | 2941 Variable* variable = expr->expression()->AsVariableProxy()->var(); |
2942 // Delete of an unqualified identifier is disallowed in strict mode but | 2942 // Delete of an unqualified identifier is disallowed in strict mode but |
Michael Starzinger
2016/08/10 19:45:13
nit: I know this is not your code, but while you a
Toon Verwaest
2016/08/11 08:46:25
Done.
| |
2943 // "delete this" is allowed. | 2943 // "delete this" is allowed. |
2944 DCHECK(is_sloppy(language_mode()) || variable->HasThisName(isolate())); | 2944 DCHECK(is_sloppy(language_mode()) || variable->is_this()); |
2945 value = BuildVariableDelete(variable, expr->id(), | 2945 value = BuildVariableDelete(variable, expr->id(), |
2946 ast_context()->GetStateCombine()); | 2946 ast_context()->GetStateCombine()); |
2947 } else if (expr->expression()->IsProperty()) { | 2947 } else if (expr->expression()->IsProperty()) { |
2948 Property* property = expr->expression()->AsProperty(); | 2948 Property* property = expr->expression()->AsProperty(); |
2949 VisitForValue(property->obj()); | 2949 VisitForValue(property->obj()); |
2950 VisitForValue(property->key()); | 2950 VisitForValue(property->key()); |
2951 Node* key = environment()->Pop(); | 2951 Node* key = environment()->Pop(); |
2952 Node* object = environment()->Pop(); | 2952 Node* object = environment()->Pop(); |
2953 value = NewNode(javascript()->DeleteProperty(language_mode()), object, key); | 2953 value = NewNode(javascript()->DeleteProperty(language_mode()), object, key); |
2954 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 2954 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3396 Node* name = jsgraph()->Constant(variable->name()); | 3396 Node* name = jsgraph()->Constant(variable->name()); |
3397 const Operator* op = javascript()->DeleteProperty(language_mode()); | 3397 const Operator* op = javascript()->DeleteProperty(language_mode()); |
3398 Node* result = NewNode(op, global, name); | 3398 Node* result = NewNode(op, global, name); |
3399 PrepareFrameState(result, bailout_id, combine); | 3399 PrepareFrameState(result, bailout_id, combine); |
3400 return result; | 3400 return result; |
3401 } | 3401 } |
3402 case VariableLocation::PARAMETER: | 3402 case VariableLocation::PARAMETER: |
3403 case VariableLocation::LOCAL: | 3403 case VariableLocation::LOCAL: |
3404 case VariableLocation::CONTEXT: { | 3404 case VariableLocation::CONTEXT: { |
3405 // Local var, const, or let variable or context variable. | 3405 // Local var, const, or let variable or context variable. |
3406 return jsgraph()->BooleanConstant(variable->HasThisName(isolate())); | 3406 return jsgraph()->BooleanConstant(variable->is_this()); |
3407 } | 3407 } |
3408 case VariableLocation::LOOKUP: { | 3408 case VariableLocation::LOOKUP: { |
3409 // Dynamic lookup of context variable (anywhere in the chain). | 3409 // Dynamic lookup of context variable (anywhere in the chain). |
3410 Node* name = jsgraph()->Constant(variable->name()); | 3410 Node* name = jsgraph()->Constant(variable->name()); |
3411 const Operator* op = | 3411 const Operator* op = |
3412 javascript()->CallRuntime(Runtime::kDeleteLookupSlot); | 3412 javascript()->CallRuntime(Runtime::kDeleteLookupSlot); |
3413 Node* result = NewNode(op, name); | 3413 Node* result = NewNode(op, name); |
3414 PrepareFrameState(result, bailout_id, combine); | 3414 PrepareFrameState(result, bailout_id, combine); |
3415 return result; | 3415 return result; |
3416 } | 3416 } |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4320 // Phi does not exist yet, introduce one. | 4320 // Phi does not exist yet, introduce one. |
4321 value = NewPhi(inputs, value, control); | 4321 value = NewPhi(inputs, value, control); |
4322 value->ReplaceInput(inputs - 1, other); | 4322 value->ReplaceInput(inputs - 1, other); |
4323 } | 4323 } |
4324 return value; | 4324 return value; |
4325 } | 4325 } |
4326 | 4326 |
4327 } // namespace compiler | 4327 } // namespace compiler |
4328 } // namespace internal | 4328 } // namespace internal |
4329 } // namespace v8 | 4329 } // namespace v8 |
OLD | NEW |