| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index e7f8dc0d771fe231a8404550b31ce1f8813d0b6e..54b3a811670f944d466be20f55af39eaccffcef5 100644
|
| --- a/src/hydrogen.cc
|
| +++ b/src/hydrogen.cc
|
| @@ -3807,7 +3807,7 @@ void TestContext::BuildBranch(HValue* value) {
|
|
|
|
|
| void HOptimizedGraphBuilder::Bailout(const char* reason) {
|
| - current_info()->set_bailout_reason(reason);
|
| + info()->set_bailout_reason(reason);
|
| SetStackOverflow();
|
| }
|
|
|
| @@ -3864,11 +3864,11 @@ void HOptimizedGraphBuilder::VisitExpressions(
|
|
|
|
|
| bool HOptimizedGraphBuilder::BuildGraph() {
|
| - if (current_info()->function()->is_generator()) {
|
| + if (info()->function()->is_generator()) {
|
| Bailout("function is a generator");
|
| return false;
|
| }
|
| - Scope* scope = current_info()->scope();
|
| + Scope* scope = info()->scope();
|
| if (scope->HasIllegalRedeclaration()) {
|
| Bailout("function with illegal redeclaration");
|
| return false;
|
| @@ -3912,7 +3912,7 @@ bool HOptimizedGraphBuilder::BuildGraph() {
|
| AddInstruction(
|
| new(zone()) HStackCheck(context, HStackCheck::kFunctionEntry));
|
|
|
| - VisitStatements(current_info()->function()->body());
|
| + VisitStatements(info()->function()->body());
|
| if (HasStackOverflow()) return false;
|
|
|
| if (current_block() != NULL) {
|
| @@ -3924,7 +3924,7 @@ bool HOptimizedGraphBuilder::BuildGraph() {
|
| // last time this function was compiled, then this recompile is likely not
|
| // due to missing/inadequate type feedback, but rather too aggressive
|
| // optimization. Disable optimistic LICM in that case.
|
| - Handle<Code> unoptimized_code(current_info()->shared_info()->code());
|
| + Handle<Code> unoptimized_code(info()->shared_info()->code());
|
| ASSERT(unoptimized_code->kind() == Code::FUNCTION);
|
| Handle<TypeFeedbackInfo> type_info(
|
| TypeFeedbackInfo::cast(unoptimized_code->type_feedback_info()));
|
| @@ -5113,7 +5113,7 @@ void HOptimizedGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
|
|
|
|
|
| bool HOptimizedGraphBuilder::HasOsrEntryAt(IterationStatement* statement) {
|
| - return statement->OsrEntryId() == current_info()->osr_ast_id();
|
| + return statement->OsrEntryId() == info()->osr_ast_id();
|
| }
|
|
|
|
|
| @@ -5500,9 +5500,9 @@ void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) {
|
| ASSERT(current_block() != NULL);
|
| ASSERT(current_block()->HasPredecessor());
|
| Handle<SharedFunctionInfo> shared_info =
|
| - SearchSharedFunctionInfo(current_info()->shared_info()->code(), expr);
|
| + SearchSharedFunctionInfo(info()->shared_info()->code(), expr);
|
| if (shared_info.is_null()) {
|
| - shared_info = Compiler::BuildFunctionInfo(expr, current_info()->script());
|
| + shared_info = Compiler::BuildFunctionInfo(expr, info()->script());
|
| }
|
| // We also have a stack overflow if the recursive compilation did.
|
| if (HasStackOverflow()) return;
|
| @@ -5563,10 +5563,10 @@ void HOptimizedGraphBuilder::VisitConditional(Conditional* expr) {
|
| HOptimizedGraphBuilder::GlobalPropertyAccess
|
| HOptimizedGraphBuilder::LookupGlobalProperty(
|
| Variable* var, LookupResult* lookup, bool is_store) {
|
| - if (var->is_this() || !current_info()->has_global_object()) {
|
| + if (var->is_this() || !info()->has_global_object()) {
|
| return kUseGeneric;
|
| }
|
| - Handle<GlobalObject> global(current_info()->global_object());
|
| + Handle<GlobalObject> global(info()->global_object());
|
| global->Lookup(*var->name(), lookup);
|
| if (!lookup->IsNormal() ||
|
| (is_store && lookup->IsReadOnly()) ||
|
| @@ -5581,7 +5581,7 @@ HOptimizedGraphBuilder::GlobalPropertyAccess
|
| HValue* HOptimizedGraphBuilder::BuildContextChainWalk(Variable* var) {
|
| ASSERT(var->IsContextSlot());
|
| HValue* context = environment()->LookupContext();
|
| - int length = current_info()->scope()->ContextChainLength(var->scope());
|
| + int length = info()->scope()->ContextChainLength(var->scope());
|
| while (length-- > 0) {
|
| HInstruction* context_instruction = new(zone()) HOuterContext(context);
|
| AddInstruction(context_instruction);
|
| @@ -5617,12 +5617,12 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
|
| LookupGlobalProperty(variable, &lookup, false);
|
|
|
| if (type == kUseCell &&
|
| - current_info()->global_object()->IsAccessCheckNeeded()) {
|
| + info()->global_object()->IsAccessCheckNeeded()) {
|
| type = kUseGeneric;
|
| }
|
|
|
| if (type == kUseCell) {
|
| - Handle<GlobalObject> global(current_info()->global_object());
|
| + Handle<GlobalObject> global(info()->global_object());
|
| Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(&lookup));
|
| HLoadGlobalCell* instr =
|
| new(zone()) HLoadGlobalCell(cell, lookup.GetPropertyDetails());
|
| @@ -6213,8 +6213,7 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
|
| AddInstruction(new(zone()) HCheckPrototypeMaps(
|
| Handle<JSObject>(JSObject::cast(map->prototype())),
|
| Handle<JSObject>(JSObject::cast(proto)),
|
| - zone(),
|
| - top_info()));
|
| + zone()));
|
| }
|
|
|
| HObjectAccess field_access = HObjectAccess::ForField(map, lookup, name);
|
| @@ -6250,7 +6249,7 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
|
|
|
| if (transition_to_field) {
|
| Handle<Map> transition(lookup->GetTransitionMapFromMap(*map));
|
| - instr->SetTransition(transition, top_info());
|
| + instr->set_transition(transition);
|
| // TODO(fschneider): Record the new map type of the object in the IR to
|
| // enable elimination of redundant checks after the transition store.
|
| instr->SetGVNFlag(kChangesMaps);
|
| @@ -6553,7 +6552,7 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
|
| LookupResult lookup(isolate());
|
| GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, true);
|
| if (type == kUseCell) {
|
| - Handle<GlobalObject> global(current_info()->global_object());
|
| + Handle<GlobalObject> global(info()->global_object());
|
| Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(&lookup));
|
| HInstruction* instr =
|
| new(zone()) HStoreGlobalCell(value, cell, lookup.GetPropertyDetails());
|
| @@ -6618,13 +6617,13 @@ void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) {
|
| // Bail out if we try to mutate a parameter value in a function
|
| // using the arguments object. We do not (yet) correctly handle the
|
| // arguments property of the function.
|
| - if (current_info()->scope()->arguments() != NULL) {
|
| + if (info()->scope()->arguments() != NULL) {
|
| // Parameters will be allocated to context slots. We have no
|
| // direct way to detect that the variable is a parameter so we do
|
| // a linear search of the parameter variables.
|
| - int count = current_info()->scope()->num_parameters();
|
| + int count = info()->scope()->num_parameters();
|
| for (int i = 0; i < count; ++i) {
|
| - if (var == current_info()->scope()->parameter(i)) {
|
| + if (var == info()->scope()->parameter(i)) {
|
| Bailout(
|
| "assignment to parameter, function uses arguments object");
|
| }
|
| @@ -6844,12 +6843,12 @@ void HOptimizedGraphBuilder::VisitAssignment(Assignment* expr) {
|
| // Bail out if we try to mutate a parameter value in a function using
|
| // the arguments object. We do not (yet) correctly handle the
|
| // arguments property of the function.
|
| - if (current_info()->scope()->arguments() != NULL) {
|
| + if (info()->scope()->arguments() != NULL) {
|
| // Parameters will rewrite to context slots. We have no direct way
|
| // to detect that the variable is a parameter.
|
| - int count = current_info()->scope()->num_parameters();
|
| + int count = info()->scope()->num_parameters();
|
| for (int i = 0; i < count; ++i) {
|
| - if (var == current_info()->scope()->parameter(i)) {
|
| + if (var == info()->scope()->parameter(i)) {
|
| return Bailout("assignment to parameter in arguments object");
|
| }
|
| }
|
| @@ -7011,8 +7010,8 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic(
|
| Handle<JSObject> holder(lookup.holder());
|
| Handle<Map> holder_map(holder->map());
|
| AddCheckMap(object, map);
|
| - AddInstruction(new(zone()) HCheckPrototypeMaps(
|
| - prototype, holder, zone(), top_info()));
|
| + AddInstruction(
|
| + new(zone()) HCheckPrototypeMaps(prototype, holder, zone()));
|
| HValue* holder_value = AddInstruction(new(zone())
|
| HConstant(holder, Representation::Tagged()));
|
| return BuildLoadNamedField(holder_value,
|
| @@ -7026,8 +7025,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic(
|
| Handle<JSObject> holder(lookup.holder());
|
| Handle<Map> holder_map(holder->map());
|
| AddCheckMap(object, map);
|
| - AddInstruction(new(zone()) HCheckPrototypeMaps(
|
| - prototype, holder, zone(), top_info()));
|
| + AddInstruction(new(zone()) HCheckPrototypeMaps(prototype, holder, zone()));
|
| Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*holder_map));
|
| return new(zone()) HConstant(function, Representation::Tagged());
|
| }
|
| @@ -7064,8 +7062,8 @@ HInstruction* HOptimizedGraphBuilder::BuildMonomorphicElementAccess(
|
| isolate()->IsFastArrayConstructorPrototypeChainIntact()) {
|
| Handle<JSObject> prototype(JSObject::cast(map->prototype()), isolate());
|
| Handle<JSObject> object_prototype = isolate()->initial_object_prototype();
|
| - AddInstruction(new(zone()) HCheckPrototypeMaps(
|
| - prototype, object_prototype, zone(), top_info()));
|
| + AddInstruction(
|
| + new(zone()) HCheckPrototypeMaps(prototype, object_prototype, zone()));
|
| load_mode = ALLOW_RETURN_HOLE;
|
| graph()->MarkDependsOnEmptyArrayProtoElements();
|
| }
|
| @@ -7580,8 +7578,8 @@ void HOptimizedGraphBuilder::AddCheckPrototypeMaps(Handle<JSObject> holder,
|
| Handle<Map> receiver_map) {
|
| if (!holder.is_null()) {
|
| Handle<JSObject> prototype(JSObject::cast(receiver_map->prototype()));
|
| - AddInstruction(new(zone()) HCheckPrototypeMaps(
|
| - prototype, holder, zone(), top_info()));
|
| + AddInstruction(
|
| + new(zone()) HCheckPrototypeMaps(prototype, holder, zone()));
|
| }
|
| }
|
|
|
| @@ -7726,7 +7724,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
|
| expr->ComputeTarget(map, name);
|
| AddCheckPrototypeMaps(expr->holder(), map);
|
| if (FLAG_trace_inlining && FLAG_polymorphic_inlining) {
|
| - Handle<JSFunction> caller = current_info()->closure();
|
| + Handle<JSFunction> caller = info()->closure();
|
| SmartArrayPointer<char> caller_name =
|
| caller->shared()->DebugName()->ToCString();
|
| PrintF("Trying to inline the polymorphic call to %s from %s\n",
|
| @@ -7810,7 +7808,7 @@ int HOptimizedGraphBuilder::InliningAstSize(Handle<JSFunction> target) {
|
|
|
| // Precondition: call is monomorphic and we have found a target with the
|
| // appropriate arity.
|
| - Handle<JSFunction> caller = current_info()->closure();
|
| + Handle<JSFunction> caller = info()->closure();
|
| Handle<SharedFunctionInfo> target_shared(target->shared());
|
|
|
| // Do a quick check on source code length to avoid parsing large
|
| @@ -7846,7 +7844,7 @@ bool HOptimizedGraphBuilder::TryInline(CallKind call_kind,
|
| int nodes_added = InliningAstSize(target);
|
| if (nodes_added == kNotInlinable) return false;
|
|
|
| - Handle<JSFunction> caller = current_info()->closure();
|
| + Handle<JSFunction> caller = info()->closure();
|
|
|
| if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) {
|
| TraceInline(target, caller, "target AST is too large [early]");
|
| @@ -7855,7 +7853,7 @@ bool HOptimizedGraphBuilder::TryInline(CallKind call_kind,
|
|
|
| #if !defined(V8_TARGET_ARCH_IA32)
|
| // Target must be able to use caller's context.
|
| - CompilationInfo* outer_info = current_info();
|
| + CompilationInfo* outer_info = info();
|
| if (target->context() != outer_info->closure()->context() ||
|
| outer_info->scope()->contains_with() ||
|
| outer_info->scope()->num_heap_slots() > 0) {
|
| @@ -8290,8 +8288,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
|
| Call::GetPrototypeForPrimitiveCheck(STRING_CHECK,
|
| expr->holder()->GetIsolate()),
|
| expr->holder(),
|
| - zone(),
|
| - top_info()));
|
| + zone()));
|
| HInstruction* char_code =
|
| BuildStringCharCodeAt(context, string, index);
|
| if (id == kStringCharCodeAt) {
|
| @@ -8442,7 +8439,7 @@ bool HOptimizedGraphBuilder::TryCallApply(Call* expr) {
|
| return false;
|
| }
|
|
|
| - if (current_info()->scope()->arguments() == NULL) return false;
|
| + if (info()->scope()->arguments() == NULL) return false;
|
|
|
| ZoneList<Expression*>* args = expr->arguments();
|
| if (args->length() != 2) return false;
|
| @@ -8683,8 +8680,8 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
|
| LookupResult lookup(isolate());
|
| GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, false);
|
| if (type == kUseCell &&
|
| - !current_info()->global_object()->IsAccessCheckNeeded()) {
|
| - Handle<GlobalObject> global(current_info()->global_object());
|
| + !info()->global_object()->IsAccessCheckNeeded()) {
|
| + Handle<GlobalObject> global(info()->global_object());
|
| known_global_function = expr->ComputeGlobalTarget(global, &lookup);
|
| }
|
| if (known_global_function) {
|
| @@ -8719,7 +8716,7 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
|
| }
|
| if (TryInlineCall(expr)) return;
|
|
|
| - if (expr->target().is_identical_to(current_info()->closure())) {
|
| + if (expr->target().is_identical_to(info()->closure())) {
|
| graph()->MarkRecursive();
|
| }
|
|
|
| @@ -9218,13 +9215,13 @@ void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) {
|
| // Bail out if we try to mutate a parameter value in a function
|
| // using the arguments object. We do not (yet) correctly handle the
|
| // arguments property of the function.
|
| - if (current_info()->scope()->arguments() != NULL) {
|
| + if (info()->scope()->arguments() != NULL) {
|
| // Parameters will rewrite to context slots. We have no direct
|
| // way to detect that the variable is a parameter so we use a
|
| // linear search of the parameter list.
|
| - int count = current_info()->scope()->num_parameters();
|
| + int count = info()->scope()->num_parameters();
|
| for (int i = 0; i < count; ++i) {
|
| - if (var == current_info()->scope()->parameter(i)) {
|
| + if (var == info()->scope()->parameter(i)) {
|
| return Bailout("assignment to parameter in arguments object");
|
| }
|
| }
|
| @@ -9823,10 +9820,10 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| VariableProxy* proxy = expr->right()->AsVariableProxy();
|
| bool global_function = (proxy != NULL) && proxy->var()->IsUnallocated();
|
| if (global_function &&
|
| - current_info()->has_global_object() &&
|
| - !current_info()->global_object()->IsAccessCheckNeeded()) {
|
| + info()->has_global_object() &&
|
| + !info()->global_object()->IsAccessCheckNeeded()) {
|
| Handle<String> name = proxy->name();
|
| - Handle<GlobalObject> global(current_info()->global_object());
|
| + Handle<GlobalObject> global(info()->global_object());
|
| LookupResult lookup(isolate());
|
| global->Lookup(*name, &lookup);
|
| if (lookup.IsNormal() && lookup.GetValue()->IsJSFunction()) {
|
| @@ -10269,9 +10266,9 @@ void HOptimizedGraphBuilder::VisitDeclarations(
|
| Handle<FixedArray> array =
|
| isolate()->factory()->NewFixedArray(globals_.length(), TENURED);
|
| for (int i = 0; i < globals_.length(); ++i) array->set(i, *globals_.at(i));
|
| - int flags = DeclareGlobalsEvalFlag::encode(current_info()->is_eval()) |
|
| - DeclareGlobalsNativeFlag::encode(current_info()->is_native()) |
|
| - DeclareGlobalsLanguageMode::encode(current_info()->language_mode());
|
| + int flags = DeclareGlobalsEvalFlag::encode(info()->is_eval()) |
|
| + DeclareGlobalsNativeFlag::encode(info()->is_native()) |
|
| + DeclareGlobalsLanguageMode::encode(info()->language_mode());
|
| HInstruction* result = new(zone()) HDeclareGlobals(
|
| environment()->LookupContext(), array, flags);
|
| AddInstruction(result);
|
| @@ -10325,8 +10322,8 @@ void HOptimizedGraphBuilder::VisitFunctionDeclaration(
|
| switch (variable->location()) {
|
| case Variable::UNALLOCATED: {
|
| globals_.Add(variable->name(), zone());
|
| - Handle<SharedFunctionInfo> function = Compiler::BuildFunctionInfo(
|
| - declaration->fun(), current_info()->script());
|
| + Handle<SharedFunctionInfo> function =
|
| + Compiler::BuildFunctionInfo(declaration->fun(), info()->script());
|
| // Check for stack-overflow exception.
|
| if (function.is_null()) return SetStackOverflow();
|
| globals_.Add(function, zone());
|
|
|