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/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" |
9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
10 #include "src/compiler/js-type-feedback.h" | 10 #include "src/compiler/js-type-feedback.h" |
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 javascript()->StrictEqual(), should_filter, jsgraph()->TrueConstant()); | 1286 javascript()->StrictEqual(), should_filter, jsgraph()->TrueConstant()); |
1287 test_should_filter.If(should_filter_cond); | 1287 test_should_filter.If(should_filter_cond); |
1288 test_should_filter.Then(); | 1288 test_should_filter.Then(); |
1289 value = environment()->Pop(); | 1289 value = environment()->Pop(); |
1290 Node* builtins = BuildLoadBuiltinsObject(); | 1290 Node* builtins = BuildLoadBuiltinsObject(); |
1291 Node* function = BuildLoadObjectField( | 1291 Node* function = BuildLoadObjectField( |
1292 builtins, | 1292 builtins, |
1293 JSBuiltinsObject::OffsetOfFunctionWithId(Builtins::FILTER_KEY)); | 1293 JSBuiltinsObject::OffsetOfFunctionWithId(Builtins::FILTER_KEY)); |
1294 // result is either the string key or Smi(0) indicating the property | 1294 // result is either the string key or Smi(0) indicating the property |
1295 // is gone. | 1295 // is gone. |
1296 Node* res = NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS), | 1296 Node* res = NewNode( |
1297 function, obj, value); | 1297 javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS, language_mode()), |
| 1298 function, obj, value); |
1298 PrepareFrameState(res, stmt->FilterId(), OutputFrameStateCombine::Push()); | 1299 PrepareFrameState(res, stmt->FilterId(), OutputFrameStateCombine::Push()); |
1299 Node* property_missing = | 1300 Node* property_missing = |
1300 NewNode(javascript()->StrictEqual(), res, jsgraph()->ZeroConstant()); | 1301 NewNode(javascript()->StrictEqual(), res, jsgraph()->ZeroConstant()); |
1301 { | 1302 { |
1302 IfBuilder is_property_missing(this); | 1303 IfBuilder is_property_missing(this); |
1303 is_property_missing.If(property_missing); | 1304 is_property_missing.If(property_missing); |
1304 is_property_missing.Then(); | 1305 is_property_missing.Then(); |
1305 // Inc counter and continue. | 1306 // Inc counter and continue. |
1306 Node* index_inc = | 1307 Node* index_inc = |
1307 NewNode(javascript()->Add(LanguageMode::SLOPPY), index, | 1308 NewNode(javascript()->Add(LanguageMode::SLOPPY), index, |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 OutputFrameStateCombine::PokeAt(arg_count + 1)); | 2192 OutputFrameStateCombine::PokeAt(arg_count + 1)); |
2192 Node* new_callee = NewNode(common()->Projection(0), pair); | 2193 Node* new_callee = NewNode(common()->Projection(0), pair); |
2193 Node* new_receiver = NewNode(common()->Projection(1), pair); | 2194 Node* new_receiver = NewNode(common()->Projection(1), pair); |
2194 | 2195 |
2195 // Patch callee and receiver on the environment. | 2196 // Patch callee and receiver on the environment. |
2196 environment()->Poke(arg_count + 1, new_callee); | 2197 environment()->Poke(arg_count + 1, new_callee); |
2197 environment()->Poke(arg_count + 0, new_receiver); | 2198 environment()->Poke(arg_count + 0, new_receiver); |
2198 } | 2199 } |
2199 | 2200 |
2200 // Create node to perform the function call. | 2201 // Create node to perform the function call. |
2201 const Operator* call = javascript()->CallFunction(args->length() + 2, flags); | 2202 const Operator* call = |
| 2203 javascript()->CallFunction(args->length() + 2, flags, language_mode()); |
2202 Node* value = ProcessArguments(call, args->length() + 2); | 2204 Node* value = ProcessArguments(call, args->length() + 2); |
2203 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 2205 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
2204 ast_context()->ProduceValue(value); | 2206 ast_context()->ProduceValue(value); |
2205 } | 2207 } |
2206 | 2208 |
2207 | 2209 |
2208 void AstGraphBuilder::VisitCallNew(CallNew* expr) { | 2210 void AstGraphBuilder::VisitCallNew(CallNew* expr) { |
2209 VisitForValue(expr->expression()); | 2211 VisitForValue(expr->expression()); |
2210 | 2212 |
2211 // Evaluate all arguments to the construct call. | 2213 // Evaluate all arguments to the construct call. |
(...skipping 23 matching lines...) Expand all Loading... |
2235 PrepareFrameState(callee_value, BailoutId::None(), | 2237 PrepareFrameState(callee_value, BailoutId::None(), |
2236 OutputFrameStateCombine::Push()); | 2238 OutputFrameStateCombine::Push()); |
2237 environment()->Push(callee_value); | 2239 environment()->Push(callee_value); |
2238 environment()->Push(receiver_value); | 2240 environment()->Push(receiver_value); |
2239 | 2241 |
2240 // Evaluate all arguments to the JS runtime call. | 2242 // Evaluate all arguments to the JS runtime call. |
2241 ZoneList<Expression*>* args = expr->arguments(); | 2243 ZoneList<Expression*>* args = expr->arguments(); |
2242 VisitForValues(args); | 2244 VisitForValues(args); |
2243 | 2245 |
2244 // Create node to perform the JS runtime call. | 2246 // Create node to perform the JS runtime call. |
2245 const Operator* call = javascript()->CallFunction(args->length() + 2, flags); | 2247 const Operator* call = |
| 2248 javascript()->CallFunction(args->length() + 2, flags, language_mode()); |
2246 Node* value = ProcessArguments(call, args->length() + 2); | 2249 Node* value = ProcessArguments(call, args->length() + 2); |
2247 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 2250 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
2248 ast_context()->ProduceValue(value); | 2251 ast_context()->ProduceValue(value); |
2249 } | 2252 } |
2250 | 2253 |
2251 | 2254 |
2252 void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) { | 2255 void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) { |
2253 const Runtime::Function* function = expr->function(); | 2256 const Runtime::Function* function = expr->function(); |
2254 | 2257 |
2255 // Handle calls to runtime functions implemented in JavaScript separately as | 2258 // Handle calls to runtime functions implemented in JavaScript separately as |
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3582 // Phi does not exist yet, introduce one. | 3585 // Phi does not exist yet, introduce one. |
3583 value = NewPhi(inputs, value, control); | 3586 value = NewPhi(inputs, value, control); |
3584 value->ReplaceInput(inputs - 1, other); | 3587 value->ReplaceInput(inputs - 1, other); |
3585 } | 3588 } |
3586 return value; | 3589 return value; |
3587 } | 3590 } |
3588 | 3591 |
3589 } // namespace compiler | 3592 } // namespace compiler |
3590 } // namespace internal | 3593 } // namespace internal |
3591 } // namespace v8 | 3594 } // namespace v8 |
OLD | NEW |