Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index 01cde01515d0693054abe1b5e21d969cbd5021e0..d33b05ac18fcd74b2ffe485b6bdc120659e18e95 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -75,7 +75,7 @@ bool AstGraphBuilder::CreateGraph() { |
// Emit tracing call if requested to do so. |
if (FLAG_trace) { |
- NewNode(javascript()->Runtime(Runtime::kTraceEnter, 0)); |
+ NewNode(javascript()->CallRuntime(Runtime::kTraceEnter, 0)); |
} |
// Visit implicit declaration of the function name. |
@@ -87,7 +87,7 @@ bool AstGraphBuilder::CreateGraph() { |
VisitDeclarations(scope->declarations()); |
// TODO(mstarzinger): This should do an inlined stack check. |
- Node* node = NewNode(javascript()->Runtime(Runtime::kStackGuard, 0)); |
+ Node* node = NewNode(javascript()->CallRuntime(Runtime::kStackGuard, 0)); |
PrepareFrameState(node, BailoutId::FunctionEntry()); |
// Visit statements in the function body. |
@@ -98,7 +98,7 @@ bool AstGraphBuilder::CreateGraph() { |
if (FLAG_trace) { |
// TODO(mstarzinger): Only traces implicit return. |
Node* return_value = jsgraph()->UndefinedConstant(); |
- NewNode(javascript()->Runtime(Runtime::kTraceExit, 1), return_value); |
+ NewNode(javascript()->CallRuntime(Runtime::kTraceExit, 1), return_value); |
} |
// Return 'undefined' in case we can fall off the end. |
@@ -643,20 +643,20 @@ void AstGraphBuilder::VisitForInStatement(ForInStatement* stmt) { |
// TODO(dcarney): should do a fast enum cache check here to skip runtime. |
environment()->Push(obj); |
Node* cache_type = ProcessArguments( |
- javascript()->Runtime(Runtime::kGetPropertyNamesFast, 1), 1); |
+ javascript()->CallRuntime(Runtime::kGetPropertyNamesFast, 1), 1); |
// TODO(dcarney): these next runtime calls should be removed in favour of |
// a few simplified instructions. |
environment()->Push(obj); |
environment()->Push(cache_type); |
Node* cache_pair = |
- ProcessArguments(javascript()->Runtime(Runtime::kForInInit, 2), 2); |
+ ProcessArguments(javascript()->CallRuntime(Runtime::kForInInit, 2), 2); |
// cache_type may have been replaced. |
Node* cache_array = NewNode(common()->Projection(0), cache_pair); |
cache_type = NewNode(common()->Projection(1), cache_pair); |
environment()->Push(cache_type); |
environment()->Push(cache_array); |
Node* cache_length = ProcessArguments( |
- javascript()->Runtime(Runtime::kForInCacheArrayLength, 2), 2); |
+ javascript()->CallRuntime(Runtime::kForInCacheArrayLength, 2), 2); |
{ |
// TODO(dcarney): this check is actually supposed to be for the |
// empty enum case only. |
@@ -692,8 +692,8 @@ void AstGraphBuilder::VisitForInStatement(ForInStatement* stmt) { |
environment()->Push(cache_array); |
environment()->Push(cache_type); |
environment()->Push(index); |
- Node* pair = |
- ProcessArguments(javascript()->Runtime(Runtime::kForInNext, 4), 4); |
+ Node* pair = ProcessArguments( |
+ javascript()->CallRuntime(Runtime::kForInNext, 4), 4); |
Node* value = NewNode(common()->Projection(0), pair); |
Node* should_filter = NewNode(common()->Projection(1), pair); |
environment()->Push(value); |
@@ -719,7 +719,7 @@ void AstGraphBuilder::VisitForInStatement(ForInStatement* stmt) { |
// result is either the string key or Smi(0) indicating the property |
// is gone. |
Node* res = ProcessArguments( |
- javascript()->Call(3, NO_CALL_FUNCTION_FLAGS), 3); |
+ javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS), 3); |
// TODO(jarin): provide real bailout id. |
PrepareFrameState(res, BailoutId::None()); |
Node* property_missing = NewNode(javascript()->StrictEqual(), res, |
@@ -785,7 +785,7 @@ void AstGraphBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) { |
void AstGraphBuilder::VisitDebuggerStatement(DebuggerStatement* stmt) { |
// TODO(turbofan): Do we really need a separate reloc-info for this? |
- Node* node = NewNode(javascript()->Runtime(Runtime::kDebugBreak, 0)); |
+ Node* node = NewNode(javascript()->CallRuntime(Runtime::kDebugBreak, 0)); |
PrepareFrameState(node, stmt->DebugBreakId()); |
} |
@@ -806,7 +806,7 @@ void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { |
Node* info = jsgraph()->Constant(shared_info); |
Node* pretenure = expr->pretenure() ? jsgraph()->TrueConstant() |
: jsgraph()->FalseConstant(); |
- const Operator* op = javascript()->Runtime(Runtime::kNewClosure, 3); |
+ const Operator* op = javascript()->CallRuntime(Runtime::kNewClosure, 3); |
Node* value = NewNode(op, context, info, pretenure); |
ast_context()->ProduceValue(value); |
} |
@@ -859,7 +859,7 @@ void AstGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) { |
Node* pattern = jsgraph()->Constant(expr->pattern()); |
Node* flags = jsgraph()->Constant(expr->flags()); |
const Operator* op = |
- javascript()->Runtime(Runtime::kMaterializeRegExpLiteral, 4); |
+ javascript()->CallRuntime(Runtime::kMaterializeRegExpLiteral, 4); |
Node* literal = NewNode(op, literals_array, literal_index, pattern, flags); |
PrepareFrameState(literal, expr->id(), ast_context()->GetStateCombine()); |
ast_context()->ProduceValue(literal); |
@@ -876,7 +876,8 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
Node* literal_index = jsgraph()->Constant(expr->literal_index()); |
Node* constants = jsgraph()->Constant(expr->constant_properties()); |
Node* flags = jsgraph()->Constant(expr->ComputeFlags()); |
- const Operator* op = javascript()->Runtime(Runtime::kCreateObjectLiteral, 4); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kCreateObjectLiteral, 4); |
Node* literal = NewNode(op, literals_array, literal_index, constants, flags); |
// The object is expected on the operand stack during computation of the |
@@ -925,7 +926,8 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
Node* receiver = environment()->Pop(); |
if (property->emit_store()) { |
Node* strict = jsgraph()->Constant(SLOPPY); |
- const Operator* op = javascript()->Runtime(Runtime::kSetProperty, 4); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kSetProperty, 4); |
NewNode(op, receiver, key, value, strict); |
} |
break; |
@@ -936,7 +938,8 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
Node* value = environment()->Pop(); |
Node* receiver = environment()->Pop(); |
if (property->emit_store()) { |
- const Operator* op = javascript()->Runtime(Runtime::kSetPrototype, 2); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kSetPrototype, 2); |
NewNode(op, receiver, value); |
} |
break; |
@@ -962,14 +965,15 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
Node* name = environment()->Pop(); |
Node* attr = jsgraph()->Constant(NONE); |
const Operator* op = |
- javascript()->Runtime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
+ javascript()->CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
Node* call = NewNode(op, literal, name, getter, setter, attr); |
PrepareFrameState(call, it->first->id()); |
} |
// Transform literals that contain functions to fast properties. |
if (expr->has_function()) { |
- const Operator* op = javascript()->Runtime(Runtime::kToFastProperties, 1); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kToFastProperties, 1); |
NewNode(op, literal); |
} |
@@ -987,7 +991,8 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
Node* literal_index = jsgraph()->Constant(expr->literal_index()); |
Node* constants = jsgraph()->Constant(expr->constant_elements()); |
Node* flags = jsgraph()->Constant(expr->ComputeFlags()); |
- const Operator* op = javascript()->Runtime(Runtime::kCreateArrayLiteral, 4); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kCreateArrayLiteral, 4); |
Node* literal = NewNode(op, literals_array, literal_index, constants, flags); |
// The array and the literal index are both expected on the operand stack |
@@ -1166,7 +1171,7 @@ void AstGraphBuilder::VisitYield(Yield* expr) { |
void AstGraphBuilder::VisitThrow(Throw* expr) { |
VisitForValue(expr->exception()); |
Node* exception = environment()->Pop(); |
- const Operator* op = javascript()->Runtime(Runtime::kThrow, 1); |
+ const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); |
Node* value = NewNode(op, exception); |
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
ast_context()->ProduceValue(value); |
@@ -1213,7 +1218,8 @@ void AstGraphBuilder::VisitCall(Call* expr) { |
Variable* variable = callee->AsVariableProxy()->var(); |
DCHECK(variable->location() == Variable::LOOKUP); |
Node* name = jsgraph()->Constant(variable->name()); |
- const Operator* op = javascript()->Runtime(Runtime::kLoadLookupSlot, 2); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kLoadLookupSlot, 2); |
Node* pair = NewNode(op, current_context(), name); |
callee_value = NewNode(common()->Projection(0), pair); |
receiver_value = NewNode(common()->Projection(1), pair); |
@@ -1278,7 +1284,7 @@ void AstGraphBuilder::VisitCall(Call* expr) { |
Node* strict = jsgraph()->Constant(strict_mode()); |
Node* position = jsgraph()->Constant(info()->scope()->start_position()); |
const Operator* op = |
- javascript()->Runtime(Runtime::kResolvePossiblyDirectEval, 5); |
+ javascript()->CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); |
Node* pair = NewNode(op, callee, source, receiver, strict, position); |
PrepareFrameState(pair, expr->EvalOrLookupId(), |
OutputFrameStateCombine::PokeAt(arg_count + 1)); |
@@ -1291,7 +1297,7 @@ void AstGraphBuilder::VisitCall(Call* expr) { |
} |
// Create node to perform the function call. |
- const Operator* call = javascript()->Call(args->length() + 2, flags); |
+ const Operator* call = javascript()->CallFunction(args->length() + 2, flags); |
Node* value = ProcessArguments(call, args->length() + 2); |
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
ast_context()->ProduceValue(value); |
@@ -1306,7 +1312,7 @@ void AstGraphBuilder::VisitCallNew(CallNew* expr) { |
VisitForValues(args); |
// Create node to perform the construct call. |
- const Operator* call = javascript()->CallNew(args->length() + 1); |
+ const Operator* call = javascript()->CallConstruct(args->length() + 1); |
Node* value = ProcessArguments(call, args->length() + 1); |
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
ast_context()->ProduceValue(value); |
@@ -1334,7 +1340,7 @@ void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) { |
VisitForValues(args); |
// Create node to perform the JS runtime call. |
- const Operator* call = javascript()->Call(args->length() + 2, flags); |
+ const Operator* call = javascript()->CallFunction(args->length() + 2, flags); |
Node* value = ProcessArguments(call, args->length() + 2); |
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
ast_context()->ProduceValue(value); |
@@ -1357,7 +1363,7 @@ void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) { |
// Create node to perform the runtime call. |
Runtime::FunctionId functionId = function->function_id; |
- const Operator* call = javascript()->Runtime(functionId, args->length()); |
+ const Operator* call = javascript()->CallRuntime(functionId, args->length()); |
Node* value = ProcessArguments(call, args->length()); |
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
ast_context()->ProduceValue(value); |
@@ -1571,7 +1577,7 @@ void AstGraphBuilder::VisitDeclarations(ZoneList<Declaration*>* declarations) { |
DeclareGlobalsStrictMode::encode(strict_mode()); |
Node* flags = jsgraph()->Constant(encoded_flags); |
Node* pairs = jsgraph()->Constant(data); |
- const Operator* op = javascript()->Runtime(Runtime::kDeclareGlobals, 3); |
+ const Operator* op = javascript()->CallRuntime(Runtime::kDeclareGlobals, 3); |
NewNode(op, current_context(), pairs, flags); |
globals()->Rewind(0); |
} |
@@ -1680,6 +1686,11 @@ void AstGraphBuilder::VisitLogicalExpression(BinaryOperation* expr) { |
} |
+StrictMode AstGraphBuilder::strict_mode() const { |
+ return info()->strict_mode(); |
+} |
+ |
+ |
Node* AstGraphBuilder::ProcessArguments(const Operator* op, int arity) { |
DCHECK(environment()->stack_height() >= arity); |
Node** all = info()->zone()->NewArray<Node*>(arity); |
@@ -1724,7 +1735,7 @@ Node* AstGraphBuilder::BuildArgumentsObject(Variable* arguments) { |
// Allocate and initialize a new arguments object. |
Node* callee = GetFunctionClosure(); |
- const Operator* op = javascript()->Runtime(Runtime::kNewArguments, 1); |
+ const Operator* op = javascript()->CallRuntime(Runtime::kNewArguments, 1); |
Node* object = NewNode(op, callee); |
// Assign the object to the arguments variable. |
@@ -1831,7 +1842,7 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, |
(contextual_mode == CONTEXTUAL) |
? Runtime::kLoadLookupSlot |
: Runtime::kLoadLookupSlotNoReferenceError; |
- const Operator* op = javascript()->Runtime(function_id, 2); |
+ const Operator* op = javascript()->CallRuntime(function_id, 2); |
Node* pair = NewNode(op, current_context(), name); |
PrepareFrameState(pair, bailout_id, OutputFrameStateCombine::Push(1)); |
return NewNode(common()->Projection(0), pair); |
@@ -1864,7 +1875,8 @@ Node* AstGraphBuilder::BuildVariableDelete( |
case Variable::LOOKUP: { |
// Dynamic lookup of context variable (anywhere in the chain). |
Node* name = jsgraph()->Constant(variable->name()); |
- const Operator* op = javascript()->Runtime(Runtime::kDeleteLookupSlot, 2); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kDeleteLookupSlot, 2); |
Node* result = NewNode(op, current_context(), name); |
PrepareFrameState(result, bailout_id, state_combine); |
return result; |
@@ -1950,7 +1962,8 @@ Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value, |
Node* strict = jsgraph()->Constant(strict_mode()); |
// TODO(mstarzinger): Use Runtime::kInitializeLegacyConstLookupSlot for |
// initializations of const declarations. |
- const Operator* op = javascript()->Runtime(Runtime::kStoreLookupSlot, 4); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kStoreLookupSlot, 4); |
Node* store = NewNode(op, value, current_context(), name, strict); |
PrepareFrameState(store, bailout_id); |
return store; |
@@ -1995,7 +2008,8 @@ Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable, |
BailoutId bailout_id) { |
// TODO(mstarzinger): Should be unified with the VisitThrow implementation. |
Node* variable_name = jsgraph()->Constant(variable->name()); |
- const Operator* op = javascript()->Runtime(Runtime::kThrowReferenceError, 1); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kThrowReferenceError, 1); |
Node* call = NewNode(op, variable_name); |
PrepareFrameState(call, bailout_id); |
return call; |