Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(798)

Unified Diff: src/hydrogen.cc

Issue 6624085: [Isolates] Merge 7051:7083 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
===================================================================
--- src/hydrogen.cc (revision 7083)
+++ src/hydrogen.cc (working copy)
@@ -151,6 +151,10 @@
void HBasicBlock::Goto(HBasicBlock* block, bool include_stack_check) {
+ if (block->IsInlineReturnTarget()) {
+ AddInstruction(new HLeaveInlined);
+ last_environment_ = last_environment()->outer();
+ }
AddSimulate(AstNode::kNoNumber);
HGoto* instr = new HGoto(block);
instr->set_include_stack_check(include_stack_check);
@@ -158,6 +162,18 @@
}
+void HBasicBlock::AddLeaveInlined(HValue* return_value, HBasicBlock* target) {
+ ASSERT(target->IsInlineReturnTarget());
+ ASSERT(return_value != NULL);
+ AddInstruction(new HLeaveInlined);
+ last_environment_ = last_environment()->outer();
+ last_environment()->Push(return_value);
+ AddSimulate(AstNode::kNoNumber);
+ HGoto* instr = new HGoto(target);
+ Finish(instr);
+}
+
+
void HBasicBlock::SetInitialEnvironment(HEnvironment* env) {
ASSERT(!HasEnvironment());
ASSERT(first() == NULL);
@@ -287,6 +303,13 @@
// Check that every block is finished.
ASSERT(IsFinished());
ASSERT(block_id() >= 0);
+
+ // Check that the incoming edges are in edge split form.
+ if (predecessors_.length() > 1) {
+ for (int i = 0; i < predecessors_.length(); ++i) {
+ ASSERT(predecessors_[i]->end()->SecondSuccessor() == NULL);
+ }
+ }
}
#endif
@@ -537,7 +560,6 @@
HGraph::HGraph(CompilationInfo* info)
: HSubgraph(this),
next_block_id_(0),
- info_(info),
blocks_(8),
values_(16),
phi_list_(NULL) {
@@ -546,12 +568,7 @@
}
-bool HGraph::AllowCodeMotion() const {
- return info()->shared_info()->opt_count() + 1 < Compiler::kDefaultMaxOptCount;
-}
-
-
-Handle<Code> HGraph::Compile() {
+Handle<Code> HGraph::Compile(CompilationInfo* info) {
int values = GetMaximumValueID();
if (values > LAllocator::max_initial_value_ids()) {
if (FLAG_trace_bailout) PrintF("Function is too big\n");
@@ -559,7 +576,7 @@
}
LAllocator allocator(values, this);
- LChunkBuilder builder(this, &allocator);
+ LChunkBuilder builder(info, this, &allocator);
LChunk* chunk = builder.Build();
if (chunk == NULL) return Handle<Code>::null();
@@ -570,7 +587,7 @@
if (!FLAG_use_lithium) return Handle<Code>::null();
MacroAssembler assembler(NULL, 0);
- LCodeGen generator(chunk, &assembler, info());
+ LCodeGen generator(chunk, &assembler, info);
if (FLAG_eliminate_empty_blocks) {
chunk->MarkEmptyBlocks();
@@ -580,13 +597,13 @@
if (FLAG_trace_codegen) {
PrintF("Crankshaft Compiler - ");
}
- CodeGenerator::MakeCodePrologue(info());
+ CodeGenerator::MakeCodePrologue(info);
Code::Flags flags =
Code::ComputeFlags(Code::OPTIMIZED_FUNCTION, NOT_IN_LOOP);
Handle<Code> code =
- CodeGenerator::MakeCodeEpilogue(&assembler, flags, info());
+ CodeGenerator::MakeCodeEpilogue(&assembler, flags, info);
generator.FinishCode(code);
- CodeGenerator::PrintCode(code, info());
+ CodeGenerator::PrintCode(code, info);
return code;
}
return Handle<Code>::null();
@@ -868,8 +885,8 @@
void HRangeAnalysis::InferControlFlowRange(Token::Value op,
HValue* value,
HValue* other) {
- Range* range = other->range();
- if (range == NULL) range = new Range();
+ Range temp_range;
+ Range* range = other->range() != NULL ? other->range() : &temp_range;
Range* new_range = NULL;
TraceRange("Control flow range infer %d %s %d\n",
@@ -1177,8 +1194,9 @@
class HGlobalValueNumberer BASE_EMBEDDED {
public:
- explicit HGlobalValueNumberer(HGraph* graph)
+ explicit HGlobalValueNumberer(HGraph* graph, CompilationInfo* info)
: graph_(graph),
+ info_(info),
block_side_effects_(graph_->blocks()->length()),
loop_side_effects_(graph_->blocks()->length()) {
ASSERT(HEAP->allow_allocation(false));
@@ -1198,9 +1216,14 @@
void ProcessLoopBlock(HBasicBlock* block,
HBasicBlock* before_loop,
int loop_kills);
+ bool AllowCodeMotion();
bool ShouldMove(HInstruction* instr, HBasicBlock* loop_header);
+ HGraph* graph() { return graph_; }
+ CompilationInfo* info() { return info_; }
+
HGraph* graph_;
+ CompilationInfo* info_;
// A map of block IDs to their side effects.
ZoneList<int> block_side_effects_;
@@ -1301,10 +1324,15 @@
}
+bool HGlobalValueNumberer::AllowCodeMotion() {
+ return info()->shared_info()->opt_count() + 1 < Compiler::kDefaultMaxOptCount;
+}
+
+
bool HGlobalValueNumberer::ShouldMove(HInstruction* instr,
HBasicBlock* loop_header) {
// If we've disabled code motion, don't move any instructions.
- if (!graph_->AllowCodeMotion()) return false;
+ if (!AllowCodeMotion()) return false;
// If --aggressive-loop-invariant-motion, move everything except change
// instructions.
@@ -1849,6 +1877,47 @@
}
+// Implementation of utility class to encapsulate the translation state for
+// a (possibly inlined) function.
+FunctionState::FunctionState(HGraphBuilder* owner,
+ CompilationInfo* info,
+ TypeFeedbackOracle* oracle)
+ : owner_(owner),
+ compilation_info_(info),
+ oracle_(oracle),
+ call_context_(NULL),
+ function_return_(NULL),
+ test_context_(NULL),
+ outer_(owner->function_state()) {
+ if (outer_ != NULL) {
+ // State for an inline function.
+ if (owner->ast_context()->IsTest()) {
+ HBasicBlock* if_true = owner->graph()->CreateBasicBlock();
+ HBasicBlock* if_false = owner->graph()->CreateBasicBlock();
+ if_true->MarkAsInlineReturnTarget();
+ if_false->MarkAsInlineReturnTarget();
+ // The AstContext constructor pushed on the context stack. This newed
+ // instance is the reason that AstContext can't be BASE_EMBEDDED.
+ test_context_ = new TestContext(owner, if_true, if_false);
+ } else {
+ function_return_ = owner->graph()->CreateBasicBlock();
+ function_return()->MarkAsInlineReturnTarget();
+ }
+ // Set this after possibly allocating a new TestContext above.
+ call_context_ = owner->ast_context();
+ }
+
+ // Push on the state stack.
+ owner->set_function_state(this);
+}
+
+
+FunctionState::~FunctionState() {
+ delete test_context_;
+ owner_->set_function_state(outer_);
+}
+
+
// Implementation of utility classes to represent an expression's context in
// the AST.
AstContext::AstContext(HGraphBuilder* owner, Expression::Context kind)
@@ -1934,20 +2003,8 @@
HTest* test = new HTest(value, empty_true, empty_false);
builder->current_block()->Finish(test);
- HValue* const no_return_value = NULL;
- HBasicBlock* true_target = if_true();
- if (true_target->IsInlineReturnTarget()) {
- empty_true->AddLeaveInlined(no_return_value, true_target);
- } else {
- empty_true->Goto(true_target);
- }
-
- HBasicBlock* false_target = if_false();
- if (false_target->IsInlineReturnTarget()) {
- empty_false->AddLeaveInlined(no_return_value, false_target);
- } else {
- empty_false->Goto(false_target);
- }
+ empty_true->Goto(if_true(), false);
+ empty_false->Goto(if_false(), false);
builder->set_current_block(NULL);
}
@@ -2019,8 +2076,8 @@
void HGraphBuilder::Bailout(const char* reason) {
if (FLAG_trace_bailout) {
- SmartPointer<char> debug_name = graph()->debug_name()->ToCString();
- PrintF("Bailout in HGraphBuilder: @\"%s\": %s\n", *debug_name, reason);
+ SmartPointer<char> name(info()->shared_info()->DebugName()->ToCString());
+ PrintF("Bailout in HGraphBuilder: @\"%s\": %s\n", *name, reason);
}
SetStackOverflow();
}
@@ -2067,16 +2124,16 @@
}
-HGraph* HGraphBuilder::CreateGraph(CompilationInfo* info) {
+HGraph* HGraphBuilder::CreateGraph() {
ASSERT(subgraph() == NULL);
- graph_ = new HGraph(info);
+ graph_ = new HGraph(info());
{
HPhase phase("Block building");
graph()->Initialize(CreateBasicBlock(graph()->start_environment()));
current_subgraph_ = graph();
- Scope* scope = info->scope();
+ Scope* scope = info()->scope();
if (scope->HasIllegalRedeclaration()) {
Bailout("function with illegal redeclaration");
return NULL;
@@ -2103,9 +2160,9 @@
HEnvironment* initial_env = environment()->CopyWithoutHistory();
HBasicBlock* body_entry = CreateBasicBlock(initial_env);
current_block()->Goto(body_entry);
- body_entry->SetJoinId(info->function()->id());
+ body_entry->SetJoinId(info()->function()->id());
set_current_block(body_entry);
- VisitStatements(info->function()->body());
+ VisitStatements(info()->function()->body());
if (HasStackOverflow()) return NULL;
if (current_block() != NULL) {
@@ -2143,7 +2200,7 @@
// Perform common subexpression elimination and loop-invariant code motion.
if (FLAG_use_gvn) {
HPhase phase("Global value numbering", graph());
- HGlobalValueNumberer gvn(graph());
+ HGlobalValueNumberer gvn(graph(), info());
gvn.Analyze();
}
@@ -2236,14 +2293,17 @@
// not have declarations).
if (scope->arguments() != NULL) {
if (!scope->arguments()->IsStackAllocated() ||
- !scope->arguments_shadow()->IsStackAllocated()) {
+ (scope->arguments_shadow() != NULL &&
+ !scope->arguments_shadow()->IsStackAllocated())) {
BAILOUT("context-allocated arguments");
}
HArgumentsObject* object = new HArgumentsObject;
AddInstruction(object);
graph()->SetArgumentsObject(object);
environment()->Bind(scope->arguments(), object);
- environment()->Bind(scope->arguments_shadow(), object);
+ if (scope->arguments_shadow() != NULL) {
+ environment()->Bind(scope->arguments_shadow(), object);
+ }
}
}
@@ -2263,18 +2323,6 @@
}
-HSubgraph* HGraphBuilder::CreateInlinedSubgraph(HEnvironment* outer,
- Handle<JSFunction> target,
- FunctionLiteral* function) {
- HConstant* undefined = graph()->GetConstantUndefined();
- HEnvironment* inner =
- outer->CopyForInlining(target, function, true, undefined);
- HSubgraph* subgraph = new HSubgraph(graph());
- subgraph->Initialize(CreateBasicBlock(inner));
- return subgraph;
-}
-
-
HSubgraph* HGraphBuilder::CreateEmptySubgraph() {
HSubgraph* subgraph = new HSubgraph(graph());
subgraph->Initialize(graph()->CreateBasicBlock());
@@ -2282,14 +2330,6 @@
}
-HSubgraph* HGraphBuilder::CreateBranchSubgraph(HEnvironment* env) {
- HSubgraph* subgraph = new HSubgraph(graph());
- HEnvironment* new_env = env->Copy();
- subgraph->Initialize(CreateBasicBlock(new_env));
- return subgraph;
-}
-
-
HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() {
HBasicBlock* header = graph()->CreateBasicBlock();
HEnvironment* entry_env = environment()->CopyAsLoopHeader(header);
@@ -2413,20 +2453,16 @@
VisitForControl(stmt->expression(),
test->if_true(),
test->if_false());
+ } else if (context->IsEffect()) {
+ VISIT_FOR_EFFECT(stmt->expression());
+ current_block()->Goto(function_return(), false);
} else {
- HValue* return_value = NULL;
- if (context->IsEffect()) {
- VISIT_FOR_EFFECT(stmt->expression());
- return_value = graph()->GetConstantUndefined();
- } else {
- ASSERT(context->IsValue());
- VISIT_FOR_VALUE(stmt->expression());
- return_value = environment()->Pop();
- }
- current_block()->AddLeaveInlined(return_value,
- function_return_);
- set_current_block(NULL);
+ ASSERT(context->IsValue());
+ VISIT_FOR_VALUE(stmt->expression());
+ HValue* return_value = environment()->Pop();
+ current_block()->AddLeaveInlined(return_value, function_return());
}
+ set_current_block(NULL);
}
}
@@ -2608,13 +2644,13 @@
}
}
-bool HGraph::HasOsrEntryAt(IterationStatement* statement) {
+bool HGraphBuilder::HasOsrEntryAt(IterationStatement* statement) {
return statement->OsrEntryId() == info()->osr_ast_id();
}
void HGraphBuilder::PreProcessOsrEntry(IterationStatement* statement) {
- if (!graph()->HasOsrEntryAt(statement)) return;
+ if (!HasOsrEntryAt(statement)) return;
HBasicBlock* non_osr_entry = graph()->CreateBasicBlock();
HBasicBlock* osr_entry = graph()->CreateBasicBlock();
@@ -2781,7 +2817,7 @@
void HGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) {
Handle<SharedFunctionInfo> shared_info =
- Compiler::BuildFunctionInfo(expr, graph_->info()->script());
+ Compiler::BuildFunctionInfo(expr, info()->script());
CHECK_BAILOUT;
HFunctionLiteral* instr =
new HFunctionLiteral(shared_info, expr->pretenure());
@@ -2802,18 +2838,22 @@
cond_true->SetJoinId(expr->ThenId());
cond_false->SetJoinId(expr->ElseId());
- // TOOD(kmillikin): Visit the subexpressions in the same AST context as
- // the whole expression.
+ // Visit the true and false subexpressions in the same AST context as the
+ // whole expression.
set_current_block(cond_true);
- VISIT_FOR_VALUE(expr->then_expression());
+ Visit(expr->then_expression());
+ CHECK_BAILOUT;
HBasicBlock* other = current_block();
set_current_block(cond_false);
- VISIT_FOR_VALUE(expr->else_expression());
+ Visit(expr->else_expression());
+ CHECK_BAILOUT;
- HBasicBlock* join = CreateJoin(other, current_block(), expr->id());
- set_current_block(join);
- ast_context()->ReturnValue(Pop());
+ if (!ast_context()->IsTest()) {
+ HBasicBlock* join = CreateJoin(other, current_block(), expr->id());
+ set_current_block(join);
+ if (!ast_context()->IsEffect()) ast_context()->ReturnValue(Pop());
+ }
}
@@ -2823,10 +2863,10 @@
if (var->is_this()) {
BAILOUT("global this reference");
}
- if (!graph()->info()->has_global_object()) {
+ if (!info()->has_global_object()) {
BAILOUT("no global object to optimize VariableProxy");
}
- Handle<GlobalObject> global(graph()->info()->global_object());
+ Handle<GlobalObject> global(info()->global_object());
global->Lookup(*var->name(), lookup);
if (!lookup->IsProperty()) {
BAILOUT("global variable cell not yet introduced");
@@ -2847,7 +2887,7 @@
ASSERT(var->IsContextSlot());
HInstruction* context = new HContext;
AddInstruction(context);
- int length = graph()->info()->scope()->ContextChainLength(var->scope());
+ int length = info()->scope()->ContextChainLength(var->scope());
while (length-- > 0) {
context = new HOuterContext(context);
AddInstruction(context);
@@ -2878,7 +2918,7 @@
LookupGlobalPropertyCell(variable, &lookup, false);
CHECK_BAILOUT;
- Handle<GlobalObject> global(graph()->info()->global_object());
+ Handle<GlobalObject> global(info()->global_object());
// TODO(3039103): Handle global property load through an IC call when access
// checks are enabled.
if (global->IsAccessCheckNeeded()) {
@@ -3004,55 +3044,6 @@
}
-HBasicBlock* HGraphBuilder::BuildTypeSwitch(HValue* receiver,
- ZoneMapList* maps,
- ZoneList<HSubgraph*>* body_graphs,
- HSubgraph* default_graph,
- int join_id) {
- ASSERT(maps->length() == body_graphs->length());
- HBasicBlock* join_block = graph()->CreateBasicBlock();
- AddInstruction(new HCheckNonSmi(receiver));
-
- for (int i = 0; i < maps->length(); ++i) {
- // Build the branches, connect all the target subgraphs to the join
- // block. Use the default as a target of the last branch.
- HSubgraph* if_true = body_graphs->at(i);
- HSubgraph* if_false = (i == maps->length() - 1)
- ? default_graph
- : CreateBranchSubgraph(environment());
- HCompareMap* compare =
- new HCompareMap(receiver,
- maps->at(i),
- if_true->entry_block(),
- if_false->entry_block());
- current_block()->Finish(compare);
-
- if (if_true->exit_block() != NULL) {
- // In an effect context the value of the type switch is not needed.
- // There is no need to merge it at the join block only to discard it.
- if (ast_context()->IsEffect()) {
- if_true->exit_block()->last_environment()->Drop(1);
- }
- if_true->exit_block()->Goto(join_block);
- }
-
- set_current_block(if_false->exit_block());
- }
-
- // Connect the default if necessary.
- if (current_block() != NULL) {
- if (ast_context()->IsEffect()) {
- environment()->Drop(1);
- }
- current_block()->Goto(join_block);
- }
-
- if (join_block->predecessors()->is_empty()) return NULL;
- join_block->SetJoinId(join_id);
- return join_block;
-}
-
-
// Sets the lookup result and returns true if the store can be inlined.
static bool ComputeStoredField(Handle<Map> type,
Handle<String> name,
@@ -3148,67 +3139,73 @@
HValue* value,
ZoneMapList* types,
Handle<String> name) {
- int number_of_types = Min(types->length(), kMaxStorePolymorphism);
- ZoneMapList maps(number_of_types);
- ZoneList<HSubgraph*> subgraphs(number_of_types);
- bool needs_generic = (types->length() > kMaxStorePolymorphism);
-
- // Build subgraphs for each of the specific maps.
- //
- // TODO(ager): We should recognize when the prototype chains for
- // different maps are identical. In that case we can avoid
- // repeatedly generating the same prototype map checks.
- for (int i = 0; i < number_of_types; ++i) {
+ // TODO(ager): We should recognize when the prototype chains for different
+ // maps are identical. In that case we can avoid repeatedly generating the
+ // same prototype map checks.
+ int count = 0;
+ HBasicBlock* join = NULL;
+ for (int i = 0; i < types->length() && count < kMaxStorePolymorphism; ++i) {
Handle<Map> map = types->at(i);
LookupResult lookup;
if (ComputeStoredField(map, name, &lookup)) {
- HSubgraph* subgraph = CreateBranchSubgraph(environment());
- SubgraphScope scope(this, subgraph);
+ if (count == 0) {
+ AddInstruction(new HCheckNonSmi(object)); // Only needed once.
+ join = graph()->CreateBasicBlock();
+ }
+ ++count;
+ HBasicBlock* if_true = graph()->CreateBasicBlock();
+ HBasicBlock* if_false = graph()->CreateBasicBlock();
+ HCompareMap* compare = new HCompareMap(object, map, if_true, if_false);
+ current_block()->Finish(compare);
+
+ set_current_block(if_true);
HInstruction* instr =
BuildStoreNamedField(object, name, value, map, &lookup, false);
- Push(value);
instr->set_position(expr->position());
+ // Goto will add the HSimulate for the store.
AddInstruction(instr);
- maps.Add(map);
- subgraphs.Add(subgraph);
- } else {
- needs_generic = true;
+ if (!ast_context()->IsEffect()) Push(value);
+ current_block()->Goto(join);
+
+ set_current_block(if_false);
}
}
- // If none of the properties were named fields we generate a
- // generic store.
- if (maps.length() == 0) {
+ // Finish up. Unconditionally deoptimize if we've handled all the maps we
+ // know about and do not want to handle ones we've never seen. Otherwise
+ // use a generic IC.
+ if (count == types->length() && FLAG_deoptimize_uncommon_cases) {
+ current_block()->FinishExit(new HDeoptimize);
+ } else {
HInstruction* instr = BuildStoreNamedGeneric(object, name, value);
- Push(value);
instr->set_position(expr->position());
AddInstruction(instr);
- if (instr->HasSideEffects()) AddSimulate(expr->AssignmentId());
- ast_context()->ReturnValue(Pop());
- } else {
- // Build subgraph for generic store through IC.
- HSubgraph* default_graph = CreateBranchSubgraph(environment());
- { SubgraphScope scope(this, default_graph);
- if (!needs_generic && FLAG_deoptimize_uncommon_cases) {
- default_graph->exit_block()->FinishExit(new HDeoptimize());
- default_graph->set_exit_block(NULL);
- } else {
- HInstruction* instr = BuildStoreNamedGeneric(object, name, value);
- Push(value);
- instr->set_position(expr->position());
- AddInstruction(instr);
+
+ if (join != NULL) {
+ if (!ast_context()->IsEffect()) Push(value);
+ current_block()->Goto(join);
+ } else {
+ // The HSimulate for the store should not see the stored value in
+ // effect contexts (it is not materialized at expr->id() in the
+ // unoptimized code).
+ if (instr->HasSideEffects()) {
+ if (ast_context()->IsEffect()) {
+ AddSimulate(expr->id());
+ } else {
+ Push(value);
+ AddSimulate(expr->id());
+ Drop(1);
+ }
}
+ ast_context()->ReturnValue(value);
+ return;
}
-
- HBasicBlock* new_exit_block =
- BuildTypeSwitch(object, &maps, &subgraphs, default_graph, expr->id());
- set_current_block(new_exit_block);
- // In an effect context, we did not materialized the value in the
- // predecessor environments so there's no need to handle it here.
- if (current_block() != NULL && !ast_context()->IsEffect()) {
- ast_context()->ReturnValue(Pop());
- }
}
+
+ ASSERT(join != NULL);
+ join->SetJoinId(expr->id());
+ set_current_block(join);
+ if (!ast_context()->IsEffect()) ast_context()->ReturnValue(Pop());
}
@@ -3289,7 +3286,7 @@
CHECK_BAILOUT;
bool check_hole = !lookup.IsDontDelete() || lookup.IsReadOnly();
- Handle<GlobalObject> global(graph()->info()->global_object());
+ Handle<GlobalObject> global(info()->global_object());
Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(&lookup));
HInstruction* instr = new HStoreGlobal(value, cell, check_hole);
instr->set_position(position);
@@ -3487,64 +3484,62 @@
HValue* object,
ZoneMapList* types,
Handle<String> name) {
- int number_of_types = Min(types->length(), kMaxLoadPolymorphism);
- ZoneMapList maps(number_of_types);
- ZoneList<HSubgraph*> subgraphs(number_of_types);
- bool needs_generic = (types->length() > kMaxLoadPolymorphism);
-
- // Build subgraphs for each of the specific maps.
- //
- // TODO(ager): We should recognize when the prototype chains for
- // different maps are identical. In that case we can avoid
- // repeatedly generating the same prototype map checks.
- for (int i = 0; i < number_of_types; ++i) {
+ // TODO(ager): We should recognize when the prototype chains for different
+ // maps are identical. In that case we can avoid repeatedly generating the
+ // same prototype map checks.
+ int count = 0;
+ HBasicBlock* join = NULL;
+ for (int i = 0; i < types->length() && count < kMaxLoadPolymorphism; ++i) {
Handle<Map> map = types->at(i);
LookupResult lookup;
map->LookupInDescriptors(NULL, *name, &lookup);
if (lookup.IsProperty() && lookup.type() == FIELD) {
- HSubgraph* subgraph = CreateBranchSubgraph(environment());
- SubgraphScope scope(this, subgraph);
+ if (count == 0) {
+ AddInstruction(new HCheckNonSmi(object)); // Only needed once.
+ join = graph()->CreateBasicBlock();
+ }
+ ++count;
+ HBasicBlock* if_true = graph()->CreateBasicBlock();
+ HBasicBlock* if_false = graph()->CreateBasicBlock();
+ HCompareMap* compare = new HCompareMap(object, map, if_true, if_false);
+ current_block()->Finish(compare);
+
+ set_current_block(if_true);
HLoadNamedField* instr =
BuildLoadNamedField(object, expr, map, &lookup, false);
instr->set_position(expr->position());
- instr->ClearFlag(HValue::kUseGVN); // Don't do GVN on polymorphic loads.
- PushAndAdd(instr);
- maps.Add(map);
- subgraphs.Add(subgraph);
- } else {
- needs_generic = true;
+ instr->ClearFlag(HValue::kUseGVN);
+ AddInstruction(instr);
+ if (!ast_context()->IsEffect()) Push(instr);
+ current_block()->Goto(join);
+
+ set_current_block(if_false);
}
}
- // If none of the properties were named fields we generate a
- // generic load.
- if (maps.length() == 0) {
+ // Finish up. Unconditionally deoptimize if we've handled all the maps we
+ // know about and do not want to handle ones we've never seen. Otherwise
+ // use a generic IC.
+ if (count == types->length() && FLAG_deoptimize_uncommon_cases) {
+ current_block()->FinishExit(new HDeoptimize);
+ } else {
HInstruction* instr = BuildLoadNamedGeneric(object, expr);
instr->set_position(expr->position());
- ast_context()->ReturnInstruction(instr, expr->id());
- } else {
- // Build subgraph for generic load through IC.
- HSubgraph* default_graph = CreateBranchSubgraph(environment());
- { SubgraphScope scope(this, default_graph);
- if (!needs_generic && FLAG_deoptimize_uncommon_cases) {
- default_graph->exit_block()->FinishExit(new HDeoptimize());
- default_graph->set_exit_block(NULL);
- } else {
- HInstruction* instr = BuildLoadNamedGeneric(object, expr);
- instr->set_position(expr->position());
- PushAndAdd(instr);
- }
- }
- HBasicBlock* new_exit_block =
- BuildTypeSwitch(object, &maps, &subgraphs, default_graph, expr->id());
- set_current_block(new_exit_block);
- // In an effect context, we did not materialized the value in the
- // predecessor environments so there's no need to handle it here.
- if (current_block() != NULL && !ast_context()->IsEffect()) {
- ast_context()->ReturnValue(Pop());
+ if (join != NULL) {
+ AddInstruction(instr);
+ if (!ast_context()->IsEffect()) Push(instr);
+ current_block()->Goto(join);
+ } else {
+ ast_context()->ReturnInstruction(instr, expr->id());
+ return;
}
}
+
+ ASSERT(join != NULL);
+ join->SetJoinId(expr->id());
+ set_current_block(join);
+ if (!ast_context()->IsEffect()) ast_context()->ReturnValue(Pop());
}
@@ -3836,22 +3831,26 @@
HValue* receiver,
ZoneMapList* types,
Handle<String> name) {
- int argument_count = expr->arguments()->length() + 1; // Plus receiver.
- int number_of_types = Min(types->length(), kMaxCallPolymorphism);
- ZoneMapList maps(number_of_types);
- ZoneList<HSubgraph*> subgraphs(number_of_types);
- bool needs_generic = (types->length() > kMaxCallPolymorphism);
-
- // Build subgraphs for each of the specific maps.
- //
// TODO(ager): We should recognize when the prototype chains for different
// maps are identical. In that case we can avoid repeatedly generating the
// same prototype map checks.
- for (int i = 0; i < number_of_types; ++i) {
+ int argument_count = expr->arguments()->length() + 1; // Includes receiver.
+ int count = 0;
+ HBasicBlock* join = NULL;
+ for (int i = 0; i < types->length() && count < kMaxCallPolymorphism; ++i) {
Handle<Map> map = types->at(i);
if (expr->ComputeTarget(map, name)) {
- HSubgraph* subgraph = CreateBranchSubgraph(environment());
- SubgraphScope scope(this, subgraph);
+ if (count == 0) {
+ AddInstruction(new HCheckNonSmi(receiver)); // Only needed once.
+ join = graph()->CreateBasicBlock();
+ }
+ ++count;
+ HBasicBlock* if_true = graph()->CreateBasicBlock();
+ HBasicBlock* if_false = graph()->CreateBasicBlock();
+ HCompareMap* compare = new HCompareMap(receiver, map, if_true, if_false);
+ current_block()->Finish(compare);
+
+ set_current_block(if_true);
AddCheckConstantFunction(expr, receiver, map, false);
if (FLAG_trace_inlining && FLAG_polymorphic_inlining) {
PrintF("Trying to inline the polymorphic call to %s\n",
@@ -3862,64 +3861,63 @@
// during hydrogen processing.
CHECK_BAILOUT;
HCallConstantFunction* call =
- new HCallConstantFunction(expr->target(), argument_count);
+ new HCallConstantFunction(expr->target(), argument_count);
call->set_position(expr->position());
PreProcessCall(call);
- PushAndAdd(call);
+ AddInstruction(call);
+ if (!ast_context()->IsEffect()) Push(call);
}
- maps.Add(map);
- subgraphs.Add(subgraph);
- } else {
- needs_generic = true;
+
+ if (current_block() != NULL) current_block()->Goto(join);
+ set_current_block(if_false);
}
}
- // If we couldn't compute the target for any of the maps just perform an
- // IC call.
- if (maps.length() == 0) {
+ // Finish up. Unconditionally deoptimize if we've handled all the maps we
+ // know about and do not want to handle ones we've never seen. Otherwise
+ // use a generic IC.
+ if (count == types->length() && FLAG_deoptimize_uncommon_cases) {
+ current_block()->FinishExit(new HDeoptimize);
+ } else {
HContext* context = new HContext;
AddInstruction(context);
HCallNamed* call = new HCallNamed(context, name, argument_count);
call->set_position(expr->position());
PreProcessCall(call);
- ast_context()->ReturnInstruction(call, expr->id());
- } else {
- // Build subgraph for generic call through IC.
- HSubgraph* default_graph = CreateBranchSubgraph(environment());
- { SubgraphScope scope(this, default_graph);
- if (!needs_generic && FLAG_deoptimize_uncommon_cases) {
- default_graph->exit_block()->FinishExit(new HDeoptimize());
- default_graph->set_exit_block(NULL);
- } else {
- HContext* context = new HContext;
- AddInstruction(context);
- HCallNamed* call = new HCallNamed(context, name, argument_count);
- call->set_position(expr->position());
- PreProcessCall(call);
- PushAndAdd(call);
- }
- }
- HBasicBlock* new_exit_block =
- BuildTypeSwitch(receiver, &maps, &subgraphs, default_graph, expr->id());
- set_current_block(new_exit_block);
- // In an effect context, we did not materialized the value in the
- // predecessor environments so there's no need to handle it here.
- if (new_exit_block != NULL && !ast_context()->IsEffect()) {
- ast_context()->ReturnValue(Pop());
+ if (join != NULL) {
+ AddInstruction(call);
+ if (!ast_context()->IsEffect()) Push(call);
+ current_block()->Goto(join);
+ } else {
+ ast_context()->ReturnInstruction(call, expr->id());
+ return;
}
}
+
+ // We assume that control flow is always live after an expression. So
+ // even without predecessors to the join block, we set it as the exit
+ // block and continue by adding instructions there.
+ ASSERT(join != NULL);
+ set_current_block(join);
+ if (join->HasPredecessor()) {
+ join->SetJoinId(expr->id());
+ if (!ast_context()->IsEffect()) ast_context()->ReturnValue(Pop());
+ }
}
-void HGraphBuilder::TraceInline(Handle<JSFunction> target, bool result) {
- SmartPointer<char> callee = target->shared()->DebugName()->ToCString();
- SmartPointer<char> caller =
- graph()->info()->function()->debug_name()->ToCString();
- if (result) {
- PrintF("Inlined %s called from %s.\n", *callee, *caller);
- } else {
- PrintF("Do not inline %s called from %s.\n", *callee, *caller);
+void HGraphBuilder::TraceInline(Handle<JSFunction> target, const char* reason) {
+ if (FLAG_trace_inlining) {
+ SmartPointer<char> callee = target->shared()->DebugName()->ToCString();
+ SmartPointer<char> caller =
+ info()->function()->debug_name()->ToCString();
+ if (reason == NULL) {
+ PrintF("Inlined %s called from %s.\n", *callee, *caller);
+ } else {
+ PrintF("Did not inline %s called from %s (%s).\n",
+ *callee, *caller, reason);
+ }
}
}
@@ -3934,150 +3932,156 @@
// Do a quick check on source code length to avoid parsing large
// inlining candidates.
if (FLAG_limit_inlining && target->shared()->SourceSize() > kMaxSourceSize) {
- if (FLAG_trace_inlining) TraceInline(target, false);
+ TraceInline(target, "target text too big");
return false;
}
// Target must be inlineable.
- if (!target->IsInlineable()) return false;
+ if (!target->IsInlineable()) {
+ TraceInline(target, "target not inlineable");
+ return false;
+ }
// No context change required.
- CompilationInfo* outer_info = graph()->info();
+ CompilationInfo* outer_info = info();
if (target->context() != outer_info->closure()->context() ||
outer_info->scope()->contains_with() ||
outer_info->scope()->num_heap_slots() > 0) {
+ TraceInline(target, "target requires context change");
return false;
}
// Don't inline deeper than two calls.
HEnvironment* env = environment();
- if (env->outer() != NULL && env->outer()->outer() != NULL) return false;
+ if (env->outer() != NULL && env->outer()->outer() != NULL) {
+ TraceInline(target, "inline depth limit reached");
+ return false;
+ }
// Don't inline recursive functions.
- if (target->shared() == outer_info->closure()->shared()) return false;
+ if (target->shared() == outer_info->closure()->shared()) {
+ TraceInline(target, "target is recursive");
+ return false;
+ }
// We don't want to add more than a certain number of nodes from inlining.
if (FLAG_limit_inlining && inlined_count_ > kMaxInlinedNodes) {
- if (FLAG_trace_inlining) TraceInline(target, false);
+ TraceInline(target, "cumulative AST node limit reached");
return false;
}
int count_before = AstNode::Count();
// Parse and allocate variables.
- CompilationInfo inner_info(target);
- if (!ParserApi::Parse(&inner_info) ||
- !Scope::Analyze(&inner_info)) {
- if (inner_info.isolate()->has_pending_exception()) {
+ CompilationInfo target_info(target);
+ if (!ParserApi::Parse(&target_info) ||
+ !Scope::Analyze(&target_info)) {
+ if (target_info.isolate()->has_pending_exception()) {
+ // Parse or scope error, never optimize this function.
SetStackOverflow();
- // Stop trying to optimize and inline this function.
target->shared()->set_optimization_disabled(true);
}
+ TraceInline(target, "parse failure");
return false;
}
- if (inner_info.scope()->num_heap_slots() > 0) return false;
- FunctionLiteral* function = inner_info.function();
+ if (target_info.scope()->num_heap_slots() > 0) {
+ TraceInline(target, "target has context-allocated variables");
+ return false;
+ }
+ FunctionLiteral* function = target_info.function();
+
// Count the number of AST nodes added by inlining this call.
int nodes_added = AstNode::Count() - count_before;
if (FLAG_limit_inlining && nodes_added > kMaxInlinedSize) {
- if (FLAG_trace_inlining) TraceInline(target, false);
+ TraceInline(target, "target AST is too large");
return false;
}
// Check if we can handle all declarations in the inlined functions.
- VisitDeclarations(inner_info.scope()->declarations());
+ VisitDeclarations(target_info.scope()->declarations());
if (HasStackOverflow()) {
+ TraceInline(target, "target has non-trivial declaration");
ClearStackOverflow();
return false;
}
// Don't inline functions that uses the arguments object or that
// have a mismatching number of parameters.
- Handle<SharedFunctionInfo> shared(target->shared());
+ Handle<SharedFunctionInfo> target_shared(target->shared());
int arity = expr->arguments()->length();
if (function->scope()->arguments() != NULL ||
- arity != shared->formal_parameter_count()) {
+ arity != target_shared->formal_parameter_count()) {
+ TraceInline(target, "target requires special argument handling");
return false;
}
// All statements in the body must be inlineable.
for (int i = 0, count = function->body()->length(); i < count; ++i) {
- if (!function->body()->at(i)->IsInlineable()) return false;
+ if (!function->body()->at(i)->IsInlineable()) {
+ TraceInline(target, "target contains unsupported syntax");
+ return false;
+ }
}
// Generate the deoptimization data for the unoptimized version of
// the target function if we don't already have it.
- if (!shared->has_deoptimization_support()) {
+ if (!target_shared->has_deoptimization_support()) {
// Note that we compile here using the same AST that we will use for
// generating the optimized inline code.
- inner_info.EnableDeoptimizationSupport();
- if (!FullCodeGenerator::MakeCode(&inner_info)) return false;
- shared->EnableDeoptimizationSupport(*inner_info.code());
- Compiler::RecordFunctionCompilation(
- Logger::FUNCTION_TAG, &inner_info, shared);
+ target_info.EnableDeoptimizationSupport();
+ if (!FullCodeGenerator::MakeCode(&target_info)) {
+ TraceInline(target, "could not generate deoptimization info");
+ return false;
+ }
+ target_shared->EnableDeoptimizationSupport(*target_info.code());
+ Compiler::RecordFunctionCompilation(Logger::FUNCTION_TAG,
+ &target_info,
+ target_shared);
}
+ // ----------------------------------------------------------------
// Save the pending call context and type feedback oracle. Set up new ones
// for the inlined function.
- ASSERT(shared->has_deoptimization_support());
- AstContext* saved_call_context = call_context();
- HBasicBlock* saved_function_return = function_return();
- TypeFeedbackOracle* saved_oracle = oracle();
- // On-stack replacement cannot target inlined functions. Since we don't
- // use a separate CompilationInfo structure for the inlined function, we
- // save and restore the AST ID in the original compilation info.
- int saved_osr_ast_id = graph()->info()->osr_ast_id();
-
- TestContext* test_context = NULL;
- if (ast_context()->IsTest()) {
- // Inlined body is treated as if it occurs in an 'inlined' call context
- // with true and false blocks that will forward to the real ones.
- HBasicBlock* if_true = graph()->CreateBasicBlock();
- HBasicBlock* if_false = graph()->CreateBasicBlock();
- if_true->MarkAsInlineReturnTarget();
- if_false->MarkAsInlineReturnTarget();
- // AstContext constructor pushes on the context stack.
- test_context = new TestContext(this, if_true, if_false);
- function_return_ = NULL;
- } else {
- // Inlined body is treated as if it occurs in the original call context.
- function_return_ = graph()->CreateBasicBlock();
- function_return_->MarkAsInlineReturnTarget();
- }
- call_context_ = ast_context();
- TypeFeedbackOracle new_oracle(
- Handle<Code>(shared->code()),
+ ASSERT(target_shared->has_deoptimization_support());
+ TypeFeedbackOracle target_oracle(
+ Handle<Code>(target_shared->code()),
Handle<Context>(target->context()->global_context()));
- oracle_ = &new_oracle;
- graph()->info()->SetOsrAstId(AstNode::kNoNumber);
+ FunctionState target_state(this, &target_info, &target_oracle);
- HSubgraph* body = CreateInlinedSubgraph(env, target, function);
- body->exit_block()->AddInstruction(new HEnterInlined(target, function));
- AddToSubgraph(body, function->body());
+ HConstant* undefined = graph()->GetConstantUndefined();
+ HEnvironment* inner_env =
+ environment()->CopyForInlining(target, function, true, undefined);
+ HBasicBlock* body_entry = CreateBasicBlock(inner_env);
+ current_block()->Goto(body_entry);
+
+ body_entry->SetJoinId(expr->ReturnId());
+ set_current_block(body_entry);
+ AddInstruction(new HEnterInlined(target, function));
+ VisitStatements(function->body());
if (HasStackOverflow()) {
// Bail out if the inline function did, as we cannot residualize a call
// instead.
- delete test_context;
- call_context_ = saved_call_context;
- function_return_ = saved_function_return;
- oracle_ = saved_oracle;
- graph()->info()->SetOsrAstId(saved_osr_ast_id);
+ TraceInline(target, "inline graph construction failed");
return false;
}
// Update inlined nodes count.
inlined_count_ += nodes_added;
- if (FLAG_trace_inlining) TraceInline(target, true);
+ TraceInline(target, NULL);
- if (body->exit_block() != NULL) {
+ if (current_block() != NULL) {
// Add a return of undefined if control can fall off the body. In a
// test context, undefined is false.
- HValue* return_value = graph()->GetConstantUndefined();
- if (test_context == NULL) {
- ASSERT(function_return_ != NULL);
- body->exit_block()->AddLeaveInlined(return_value, function_return_);
+ if (inlined_test_context() == NULL) {
+ ASSERT(function_return() != NULL);
+ ASSERT(call_context()->IsEffect() || call_context()->IsValue());
+ if (call_context()->IsEffect()) {
+ current_block()->Goto(function_return(), false);
+ } else {
+ current_block()->AddLeaveInlined(undefined, function_return());
+ }
} else {
// The graph builder assumes control can reach both branches of a
// test, so we materialize the undefined value and test it rather than
@@ -4086,46 +4090,29 @@
// TODO(3168478): refactor to avoid this.
HBasicBlock* empty_true = graph()->CreateBasicBlock();
HBasicBlock* empty_false = graph()->CreateBasicBlock();
- HTest* test = new HTest(return_value, empty_true, empty_false);
- body->exit_block()->Finish(test);
+ HTest* test = new HTest(undefined, empty_true, empty_false);
+ current_block()->Finish(test);
- HValue* const no_return_value = NULL;
- empty_true->AddLeaveInlined(no_return_value, test_context->if_true());
- empty_false->AddLeaveInlined(no_return_value, test_context->if_false());
+ empty_true->Goto(inlined_test_context()->if_true(), false);
+ empty_false->Goto(inlined_test_context()->if_false(), false);
}
- body->set_exit_block(NULL);
}
- // Record the environment at the inlined function call.
- AddSimulate(expr->ReturnId());
-
- // Jump to the function entry (without re-recording the environment).
- current_block()->Finish(new HGoto(body->entry_block()));
-
// Fix up the function exits.
- if (test_context != NULL) {
- HBasicBlock* if_true = test_context->if_true();
- HBasicBlock* if_false = test_context->if_false();
+ if (inlined_test_context() != NULL) {
+ HBasicBlock* if_true = inlined_test_context()->if_true();
+ HBasicBlock* if_false = inlined_test_context()->if_false();
if_true->SetJoinId(expr->id());
if_false->SetJoinId(expr->id());
- ASSERT(ast_context() == test_context);
- delete test_context; // Destructor pops from expression context stack.
+ ASSERT(ast_context() == inlined_test_context());
+ // Pop the return test context from the expression context stack.
+ ClearInlinedTestContext();
// Forward to the real test context.
- HValue* const no_return_value = NULL;
HBasicBlock* true_target = TestContext::cast(ast_context())->if_true();
- if (true_target->IsInlineReturnTarget()) {
- if_true->AddLeaveInlined(no_return_value, true_target);
- } else {
- if_true->Goto(true_target);
- }
-
HBasicBlock* false_target = TestContext::cast(ast_context())->if_false();
- if (false_target->IsInlineReturnTarget()) {
- if_false->AddLeaveInlined(no_return_value, false_target);
- } else {
- if_false->Goto(false_target);
- }
+ if_true->Goto(true_target, false);
+ if_false->Goto(false_target, false);
// TODO(kmillikin): Come up with a better way to handle this. It is too
// subtle. NULL here indicates that the enclosing context has no control
@@ -4133,29 +4120,14 @@
set_current_block(NULL);
} else {
- function_return_->SetJoinId(expr->id());
- set_current_block(function_return_);
+ function_return()->SetJoinId(expr->id());
+ set_current_block(function_return());
}
- call_context_ = saved_call_context;
- function_return_ = saved_function_return;
- oracle_ = saved_oracle;
- graph()->info()->SetOsrAstId(saved_osr_ast_id);
-
return true;
}
-void HBasicBlock::AddLeaveInlined(HValue* return_value, HBasicBlock* target) {
- ASSERT(target->IsInlineReturnTarget());
- AddInstruction(new HLeaveInlined);
- HEnvironment* outer = last_environment()->outer();
- if (return_value != NULL) outer->Push(return_value);
- UpdateEnvironment(outer);
- Goto(target);
-}
-
-
bool HGraphBuilder::TryInlineBuiltinFunction(Call* expr,
HValue* receiver,
Handle<Map> receiver_map,
@@ -4249,7 +4221,7 @@
Property* prop = callee->AsProperty();
ASSERT(prop != NULL);
- if (graph()->info()->scope()->arguments() == NULL) return false;
+ if (info()->scope()->arguments() == NULL) return false;
Handle<String> name = prop->key()->AsLiteral()->AsPropertyName();
if (!name->IsEqualTo(CStrVector("apply"))) return false;
@@ -4362,16 +4334,6 @@
AddCheckConstantFunction(expr, receiver, receiver_map, true);
if (TryInline(expr)) {
- if (current_block() != NULL) {
- HValue* return_value = Pop();
- // If we inlined a function in a test context then we need to emit
- // a simulate here to shadow the ones at the end of the
- // predecessor blocks. Those environments contain the return
- // value on top and do not correspond to any actual state of the
- // unoptimized code.
- if (ast_context()->IsEffect()) AddSimulate(expr->id());
- ast_context()->ReturnValue(return_value);
- }
return;
} else {
// Check for bailout, as the TryInline call in the if condition above
@@ -4402,14 +4364,15 @@
}
if (global_call) {
+ bool known_global_function = false;
// If there is a global property cell for the name at compile time and
// access check is not enabled we assume that the function will not change
// and generate optimized code for calling the function.
- CompilationInfo* info = graph()->info();
- bool known_global_function = info->has_global_object() &&
- !info->global_object()->IsAccessCheckNeeded() &&
- expr->ComputeGlobalTarget(Handle<GlobalObject>(info->global_object()),
- var->name());
+ if (info()->has_global_object() &&
+ !info()->global_object()->IsAccessCheckNeeded()) {
+ Handle<GlobalObject> global(info()->global_object());
+ known_global_function = expr->ComputeGlobalTarget(global, var->name());
+ }
if (known_global_function) {
// Push the global object instead of the global receiver because
// code generated by the full code generator expects it.
@@ -4434,16 +4397,6 @@
environment()->SetExpressionStackAt(receiver_index, global_receiver);
if (TryInline(expr)) {
- if (current_block() != NULL) {
- HValue* return_value = Pop();
- // If we inlined a function in a test context then we need to
- // emit a simulate here to shadow the ones at the end of the
- // predecessor blocks. Those environments contain the return
- // value on top and do not correspond to any actual state of the
- // unoptimized code.
- if (ast_context()->IsEffect()) AddSimulate(expr->id());
- ast_context()->ReturnValue(return_value);
- }
return;
}
// Check for bailout, as trying to inline might fail due to bailout
@@ -5038,7 +4991,7 @@
HValue* left = Pop();
Token::Value op = expr->op();
- TypeInfo info = oracle()->CompareType(expr);
+ TypeInfo type_info = oracle()->CompareType(expr);
HInstruction* instr = NULL;
if (op == Token::INSTANCEOF) {
// Check to see if the rhs of the instanceof is a global function not
@@ -5047,12 +5000,11 @@
Handle<JSFunction> target = Handle<JSFunction>::null();
Variable* var = expr->right()->AsVariableProxy()->AsVariable();
bool global_function = (var != NULL) && var->is_global() && !var->is_this();
- CompilationInfo* info = graph()->info();
if (global_function &&
- info->has_global_object() &&
- !info->global_object()->IsAccessCheckNeeded()) {
+ info()->has_global_object() &&
+ !info()->global_object()->IsAccessCheckNeeded()) {
Handle<String> name = var->name();
- Handle<GlobalObject> global(info->global_object());
+ Handle<GlobalObject> global(info()->global_object());
LookupResult lookup;
global->Lookup(*name, &lookup);
if (lookup.IsProperty() &&
@@ -5061,7 +5013,7 @@
Handle<JSFunction> candidate(JSFunction::cast(lookup.GetValue()));
// If the function is in new space we assume it's more likely to
// change and thus prefer the general IC code.
- if (!info->isolate()->heap()->InNewSpace(*candidate)) {
+ if (!Isolate::Current()->heap()->InNewSpace(*candidate)) {
target = candidate;
}
}
@@ -5079,7 +5031,7 @@
}
} else if (op == Token::IN) {
BAILOUT("Unsupported comparison: in");
- } else if (info.IsNonPrimitive()) {
+ } else if (type_info.IsNonPrimitive()) {
switch (op) {
case Token::EQ:
case Token::EQ_STRICT: {
@@ -5096,7 +5048,7 @@
}
} else {
HCompare* compare = new HCompare(left, right, op);
- Representation r = ToRepresentation(info);
+ Representation r = ToRepresentation(type_info);
compare->SetInputRepresentation(r);
instr = compare;
}
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698