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

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 2451853002: Uniform and precise source positions for inlining (Closed)
Patch Set: fixed PodArray::copy_out Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/crankshaft/hydrogen.h" 5 #include "src/crankshaft/hydrogen.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 } 1358 }
1359 finished_ = true; 1359 finished_ = true;
1360 } 1360 }
1361 1361
1362 1362
1363 HGraph* HGraphBuilder::CreateGraph() { 1363 HGraph* HGraphBuilder::CreateGraph() {
1364 DCHECK(!FLAG_minimal); 1364 DCHECK(!FLAG_minimal);
1365 graph_ = new (zone()) HGraph(info_, descriptor_); 1365 graph_ = new (zone()) HGraph(info_, descriptor_);
1366 if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_); 1366 if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_);
1367 if (!info_->IsStub() && is_tracking_positions()) { 1367 if (!info_->IsStub() && is_tracking_positions()) {
1368 TraceInlinedFunction(info_->shared_info(), SourcePosition::Unknown()); 1368 TraceInlinedFunction(info_->shared_info(), SourcePosition::Unknown(), -1);
1369 } 1369 }
1370 CompilationPhase phase("H_Block building", info_); 1370 CompilationPhase phase("H_Block building", info_);
1371 set_current_block(graph()->entry_block()); 1371 set_current_block(graph()->entry_block());
1372 if (!BuildGraph()) return NULL; 1372 if (!BuildGraph()) return NULL;
1373 graph()->FinalizeUniqueness(); 1373 graph()->FinalizeUniqueness();
1374 return graph_; 1374 return graph_;
1375 } 1375 }
1376 1376
1377 int HGraphBuilder::TraceInlinedFunction(Handle<SharedFunctionInfo> shared, 1377 void HGraphBuilder::TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
1378 SourcePosition position) { 1378 SourcePosition position,
1379 int inlining_id) {
1379 DCHECK(is_tracking_positions()); 1380 DCHECK(is_tracking_positions());
1380 1381
1381 int inline_id = static_cast<int>(graph()->inlined_function_infos().size());
1382 HInlinedFunctionInfo info(shared->start_position());
1383 if (!shared->script()->IsUndefined(isolate())) { 1382 if (!shared->script()->IsUndefined(isolate())) {
1384 Handle<Script> script(Script::cast(shared->script()), isolate()); 1383 Handle<Script> script(Script::cast(shared->script()), isolate());
1385 1384
1386 if (FLAG_hydrogen_track_positions && 1385 if (FLAG_hydrogen_track_positions &&
1387 !script->source()->IsUndefined(isolate())) { 1386 !script->source()->IsUndefined(isolate())) {
1388 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); 1387 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
1389 Object* source_name = script->name(); 1388 Object* source_name = script->name();
1390 OFStream os(tracing_scope.file()); 1389 OFStream os(tracing_scope.file());
1391 os << "--- FUNCTION SOURCE ("; 1390 os << "--- FUNCTION SOURCE (";
1392 if (source_name->IsString()) { 1391 if (source_name->IsString()) {
1393 os << String::cast(source_name)->ToCString().get() << ":"; 1392 os << String::cast(source_name)->ToCString().get() << ":";
1394 } 1393 }
1395 os << shared->DebugName()->ToCString().get() << ") id{"; 1394 os << shared->DebugName()->ToCString().get() << ") id{";
1396 os << info_->optimization_id() << "," << inline_id << "} ---\n"; 1395 os << info_->optimization_id() << "," << inlining_id << "} ---\n";
1397 { 1396 {
1398 DisallowHeapAllocation no_allocation; 1397 DisallowHeapAllocation no_allocation;
1399 int start = shared->start_position(); 1398 int start = shared->start_position();
1400 int len = shared->end_position() - start; 1399 int len = shared->end_position() - start;
1401 String::SubStringRange source(String::cast(script->source()), start, 1400 String::SubStringRange source(String::cast(script->source()), start,
1402 len); 1401 len);
1403 for (const auto& c : source) { 1402 for (const auto& c : source) {
1404 os << AsReversiblyEscapedUC16(c); 1403 os << AsReversiblyEscapedUC16(c);
1405 } 1404 }
1406 } 1405 }
1407 1406
1408 os << "\n--- END ---\n"; 1407 os << "\n--- END ---\n";
1409 } 1408 }
1410 } 1409 }
1411 1410
1412 graph()->inlined_function_infos().push_back(info); 1411 if (FLAG_hydrogen_track_positions && inlining_id != -1) {
1413
1414 if (FLAG_hydrogen_track_positions && inline_id != 0) {
1415 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); 1412 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
1416 OFStream os(tracing_scope.file()); 1413 OFStream os(tracing_scope.file());
1417 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{" 1414 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{"
1418 << info_->optimization_id() << "," << inline_id << "} AS " << inline_id 1415 << info_->optimization_id() << "," << inlining_id << "} AS "
1419 << " AT " << position << std::endl; 1416 << inlining_id << " AT " << position.ScriptOffset() << std::endl;
1420 } 1417 }
1421
1422 return inline_id;
1423 } 1418 }
1424 1419
1425 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { 1420 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) {
1426 DCHECK(current_block() != NULL); 1421 DCHECK(current_block() != NULL);
1427 DCHECK(!FLAG_hydrogen_track_positions || 1422 DCHECK(!FLAG_hydrogen_track_positions ||
1428 !position_.IsUnknown() || 1423 !position_.IsUnknown() ||
1429 !info_->IsOptimizing()); 1424 !info_->IsOptimizing());
1430 current_block()->AddInstruction(instr, source_position()); 1425 current_block()->AddInstruction(instr, source_position());
1431 if (graph()->IsInsideNoSideEffectsScope()) { 1426 if (graph()->IsInsideNoSideEffectsScope()) {
1432 instr->SetFlag(HValue::kHasNoObservableSideEffects); 1427 instr->SetFlag(HValue::kHasNoObservableSideEffects);
(...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after
3120 HValue* HGraphBuilder::AddLoadJSBuiltin(int context_index) { 3115 HValue* HGraphBuilder::AddLoadJSBuiltin(int context_index) {
3121 HValue* native_context = BuildGetNativeContext(); 3116 HValue* native_context = BuildGetNativeContext();
3122 HObjectAccess function_access = HObjectAccess::ForContextSlot(context_index); 3117 HObjectAccess function_access = HObjectAccess::ForContextSlot(context_index);
3123 return Add<HLoadNamedField>(native_context, nullptr, function_access); 3118 return Add<HLoadNamedField>(native_context, nullptr, function_access);
3124 } 3119 }
3125 3120
3126 HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info, 3121 HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info,
3127 bool track_positions) 3122 bool track_positions)
3128 : HGraphBuilder(info, CallInterfaceDescriptor(), track_positions), 3123 : HGraphBuilder(info, CallInterfaceDescriptor(), track_positions),
3129 function_state_(NULL), 3124 function_state_(NULL),
3130 initial_function_state_(this, info, NORMAL_RETURN, 0, 3125 initial_function_state_(this, info, NORMAL_RETURN, -1,
3131 TailCallMode::kAllow), 3126 TailCallMode::kAllow),
3132 ast_context_(NULL), 3127 ast_context_(NULL),
3133 break_scope_(NULL), 3128 break_scope_(NULL),
3134 inlined_count_(0), 3129 inlined_count_(0),
3135 globals_(10, info->zone()), 3130 globals_(10, info->zone()),
3136 osr_(new (info->zone()) HOsrBuilder(this)), 3131 osr_(new (info->zone()) HOsrBuilder(this)),
3137 bounds_(info->zone()) { 3132 bounds_(info->zone()) {
3138 // This is not initialized in the initializer list because the 3133 // This is not initialized in the initializer list because the
3139 // constructor for the initial state relies on function_state_ == NULL 3134 // constructor for the initial state relies on function_state_ == NULL
3140 // to know it's the initial state. 3135 // to know it's the initial state.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3236 info_(info), 3231 info_(info),
3237 descriptor_(descriptor), 3232 descriptor_(descriptor),
3238 zone_(info->zone()), 3233 zone_(info->zone()),
3239 allow_code_motion_(false), 3234 allow_code_motion_(false),
3240 use_optimistic_licm_(false), 3235 use_optimistic_licm_(false),
3241 depends_on_empty_array_proto_elements_(false), 3236 depends_on_empty_array_proto_elements_(false),
3242 depends_on_string_length_overflow_(false), 3237 depends_on_string_length_overflow_(false),
3243 type_change_checksum_(0), 3238 type_change_checksum_(0),
3244 maximum_environment_size_(0), 3239 maximum_environment_size_(0),
3245 no_side_effects_scope_count_(0), 3240 no_side_effects_scope_count_(0),
3246 disallow_adding_new_values_(false), 3241 disallow_adding_new_values_(false) {
3247 inlined_function_infos_(info->zone()) {
3248 if (info->IsStub()) { 3242 if (info->IsStub()) {
3249 // For stubs, explicitly add the context to the environment. 3243 // For stubs, explicitly add the context to the environment.
3250 start_environment_ = 3244 start_environment_ =
3251 new (zone_) HEnvironment(zone_, descriptor.GetParameterCount() + 1); 3245 new (zone_) HEnvironment(zone_, descriptor.GetParameterCount() + 1);
3252 } else { 3246 } else {
3253 start_environment_ = 3247 start_environment_ =
3254 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); 3248 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_);
3255 } 3249 }
3256 start_environment_->set_ast_id(BailoutId::FunctionContext()); 3250 start_environment_->set_ast_id(BailoutId::FunctionContext());
3257 entry_block_ = CreateBasicBlock(); 3251 entry_block_ = CreateBasicBlock();
(...skipping 11 matching lines...) Expand all
3269 void HGraph::FinalizeUniqueness() { 3263 void HGraph::FinalizeUniqueness() {
3270 DisallowHeapAllocation no_gc; 3264 DisallowHeapAllocation no_gc;
3271 for (int i = 0; i < blocks()->length(); ++i) { 3265 for (int i = 0; i < blocks()->length(); ++i) {
3272 for (HInstructionIterator it(blocks()->at(i)); !it.Done(); it.Advance()) { 3266 for (HInstructionIterator it(blocks()->at(i)); !it.Done(); it.Advance()) {
3273 it.Current()->FinalizeUniqueness(); 3267 it.Current()->FinalizeUniqueness();
3274 } 3268 }
3275 } 3269 }
3276 } 3270 }
3277 3271
3278 3272
3279 int HGraph::SourcePositionToScriptPosition(SourcePosition pos) {
3280 return (FLAG_hydrogen_track_positions && !pos.IsUnknown())
3281 ? inlined_function_infos_.at(pos.inlining_id()).start_position +
3282 pos.position()
3283 : pos.raw();
3284 }
3285
3286
3287 // Block ordering was implemented with two mutually recursive methods, 3273 // Block ordering was implemented with two mutually recursive methods,
3288 // HGraph::Postorder and HGraph::PostorderLoopBlocks. 3274 // HGraph::Postorder and HGraph::PostorderLoopBlocks.
3289 // The recursion could lead to stack overflow so the algorithm has been 3275 // The recursion could lead to stack overflow so the algorithm has been
3290 // implemented iteratively. 3276 // implemented iteratively.
3291 // At a high level the algorithm looks like this: 3277 // At a high level the algorithm looks like this:
3292 // 3278 //
3293 // Postorder(block, loop_header) : { 3279 // Postorder(block, loop_header) : {
3294 // if (block has already been visited or is of another loop) return; 3280 // if (block has already been visited or is of another loop) return;
3295 // mark block as visited; 3281 // mark block as visited;
3296 // if (block is a loop header) { 3282 // if (block is a loop header) {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
3701 } 3687 }
3702 // Set this after possibly allocating a new TestContext above. 3688 // Set this after possibly allocating a new TestContext above.
3703 call_context_ = owner->ast_context(); 3689 call_context_ = owner->ast_context();
3704 } 3690 }
3705 3691
3706 // Push on the state stack. 3692 // Push on the state stack.
3707 owner->set_function_state(this); 3693 owner->set_function_state(this);
3708 3694
3709 if (owner->is_tracking_positions()) { 3695 if (owner->is_tracking_positions()) {
3710 outer_source_position_ = owner->source_position(); 3696 outer_source_position_ = owner->source_position();
3711 owner->EnterInlinedSource( 3697 owner->EnterInlinedSource(inlining_id);
3712 info->shared_info()->start_position(),
3713 inlining_id);
3714 owner->SetSourcePosition(info->shared_info()->start_position()); 3698 owner->SetSourcePosition(info->shared_info()->start_position());
3715 } 3699 }
3716 } 3700 }
3717 3701
3718 3702
3719 FunctionState::~FunctionState() { 3703 FunctionState::~FunctionState() {
3720 delete test_context_; 3704 delete test_context_;
3721 owner_->set_function_state(outer_); 3705 owner_->set_function_state(outer_);
3722 3706
3723 if (owner_->is_tracking_positions()) { 3707 if (owner_->is_tracking_positions()) {
3724 owner_->set_source_position(outer_source_position_); 3708 owner_->set_source_position(outer_source_position_);
3725 owner_->EnterInlinedSource( 3709 owner_->EnterInlinedSource(outer_->inlining_id());
3726 outer_->compilation_info()->shared_info()->start_position(),
3727 outer_->inlining_id());
3728 } 3710 }
3729 } 3711 }
3730 3712
3731 3713
3732 // Implementation of utility classes to represent an expression's context in 3714 // Implementation of utility classes to represent an expression's context in
3733 // the AST. 3715 // the AST.
3734 AstContext::AstContext(HOptimizedGraphBuilder* owner, Expression::Context kind) 3716 AstContext::AstContext(HOptimizedGraphBuilder* owner, Expression::Context kind)
3735 : owner_(owner), 3717 : owner_(owner),
3736 kind_(kind), 3718 kind_(kind),
3737 outer_(owner->ast_context()), 3719 outer_(owner->ast_context()),
(...skipping 4344 matching lines...) Expand 10 before | Expand all | Expand 10 after
8082 // Generate the deoptimization data for the unoptimized version of 8064 // Generate the deoptimization data for the unoptimized version of
8083 // the target function if we don't already have it. 8065 // the target function if we don't already have it.
8084 if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { 8066 if (!Compiler::EnsureDeoptimizationSupport(&target_info)) {
8085 TraceInline(target, caller, "could not generate deoptimization info"); 8067 TraceInline(target, caller, "could not generate deoptimization info");
8086 return false; 8068 return false;
8087 } 8069 }
8088 8070
8089 // Remember that we inlined this function. This needs to be called right 8071 // Remember that we inlined this function. This needs to be called right
8090 // after the EnsureDeoptimizationSupport call so that the code flusher 8072 // after the EnsureDeoptimizationSupport call so that the code flusher
8091 // does not remove the code with the deoptimization support. 8073 // does not remove the code with the deoptimization support.
8092 top_info()->AddInlinedFunction(target_info.shared_info()); 8074 int inlining_id = top_info()->AddInlinedFunction(target_info.shared_info(),
8075 source_position());
8093 8076
8094 // ---------------------------------------------------------------- 8077 // ----------------------------------------------------------------
8095 // After this point, we've made a decision to inline this function (so 8078 // After this point, we've made a decision to inline this function (so
8096 // TryInline should always return true). 8079 // TryInline should always return true).
8097 8080
8098 // If target was lazily compiled, it's literals array may not yet be set up. 8081 // If target was lazily compiled, it's literals array may not yet be set up.
8099 JSFunction::EnsureLiterals(target); 8082 JSFunction::EnsureLiterals(target);
8100 8083
8101 // Type-check the inlined function. 8084 // Type-check the inlined function.
8102 DCHECK(target_shared->has_deoptimization_support()); 8085 DCHECK(target_shared->has_deoptimization_support());
8103 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), 8086 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(),
8104 target_info.scope(), target_info.osr_ast_id(), target_info.literal(), 8087 target_info.scope(), target_info.osr_ast_id(), target_info.literal(),
8105 &bounds_) 8088 &bounds_)
8106 .Run(); 8089 .Run();
8107 8090
8108 int inlining_id = 0;
8109 if (is_tracking_positions()) { 8091 if (is_tracking_positions()) {
8110 inlining_id = TraceInlinedFunction(target_shared, source_position()); 8092 TraceInlinedFunction(target_shared, source_position(), inlining_id);
8111 } 8093 }
8112 8094
8113 // Save the pending call context. Set up new one for the inlined function. 8095 // Save the pending call context. Set up new one for the inlined function.
8114 // The function state is new-allocated because we need to delete it 8096 // The function state is new-allocated because we need to delete it
8115 // in two different places. 8097 // in two different places.
8116 FunctionState* target_state = new FunctionState( 8098 FunctionState* target_state = new FunctionState(
8117 this, &target_info, inlining_kind, inlining_id, 8099 this, &target_info, inlining_kind, inlining_id,
8118 function_state()->ComputeTailCallMode(syntactic_tail_call_mode)); 8100 function_state()->ComputeTailCallMode(syntactic_tail_call_mode));
8119 8101
8120 HConstant* undefined = graph()->GetConstantUndefined(); 8102 HConstant* undefined = graph()->GetConstantUndefined();
(...skipping 30 matching lines...) Expand all
8151 current_block()->UpdateEnvironment(inner_env); 8133 current_block()->UpdateEnvironment(inner_env);
8152 Scope* saved_scope = scope(); 8134 Scope* saved_scope = scope();
8153 set_scope(target_info.scope()); 8135 set_scope(target_info.scope());
8154 HEnterInlined* enter_inlined = Add<HEnterInlined>( 8136 HEnterInlined* enter_inlined = Add<HEnterInlined>(
8155 return_id, target, context, arguments_count, function, 8137 return_id, target, context, arguments_count, function,
8156 function_state()->inlining_kind(), function->scope()->arguments(), 8138 function_state()->inlining_kind(), function->scope()->arguments(),
8157 arguments_object, syntactic_tail_call_mode); 8139 arguments_object, syntactic_tail_call_mode);
8158 if (is_tracking_positions()) { 8140 if (is_tracking_positions()) {
8159 enter_inlined->set_inlining_id(inlining_id); 8141 enter_inlined->set_inlining_id(inlining_id);
8160 } 8142 }
8143
8161 function_state()->set_entry(enter_inlined); 8144 function_state()->set_entry(enter_inlined);
8162 8145
8163 VisitDeclarations(target_info.scope()->declarations()); 8146 VisitDeclarations(target_info.scope()->declarations());
8164 VisitStatements(function->body()); 8147 VisitStatements(function->body());
8165 set_scope(saved_scope); 8148 set_scope(saved_scope);
8166 if (HasStackOverflow()) { 8149 if (HasStackOverflow()) {
8167 // Bail out if the inline function did, as we cannot residualize a call 8150 // Bail out if the inline function did, as we cannot residualize a call
8168 // instead, but do not disable optimization for the outer function. 8151 // instead, but do not disable optimization for the outer function.
8169 TraceInline(target, caller, "inline graph construction failed"); 8152 TraceInline(target, caller, "inline graph construction failed");
8170 target_shared->DisableOptimization(kInliningBailedOut); 8153 target_shared->DisableOptimization(kInliningBailedOut);
(...skipping 2901 matching lines...) Expand 10 before | Expand all | Expand 10 after
11072 void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) { 11055 void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) {
11073 CHECK_ALIVE(VisitForValue(expr->left())); 11056 CHECK_ALIVE(VisitForValue(expr->left()));
11074 CHECK_ALIVE(VisitForValue(expr->right())); 11057 CHECK_ALIVE(VisitForValue(expr->right()));
11075 SetSourcePosition(expr->position()); 11058 SetSourcePosition(expr->position());
11076 HValue* right = Pop(); 11059 HValue* right = Pop();
11077 HValue* left = Pop(); 11060 HValue* left = Pop();
11078 HValue* result = 11061 HValue* result =
11079 BuildBinaryOperation(expr, left, right, 11062 BuildBinaryOperation(expr, left, right,
11080 ast_context()->IsEffect() ? NO_PUSH_BEFORE_SIMULATE 11063 ast_context()->IsEffect() ? NO_PUSH_BEFORE_SIMULATE
11081 : PUSH_BEFORE_SIMULATE); 11064 : PUSH_BEFORE_SIMULATE);
11082 if (is_tracking_positions() && result->IsBinaryOperation()) {
11083 HBinaryOperation::cast(result)->SetOperandPositions(
11084 zone(),
11085 ScriptPositionToSourcePosition(expr->left()->position()),
11086 ScriptPositionToSourcePosition(expr->right()->position()));
11087 }
11088 return ast_context()->ReturnValue(result); 11065 return ast_context()->ReturnValue(result);
11089 } 11066 }
11090 11067
11091 11068
11092 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, 11069 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr,
11093 Expression* sub_expr, 11070 Expression* sub_expr,
11094 Handle<String> check) { 11071 Handle<String> check) {
11095 CHECK_ALIVE(VisitForTypeOf(sub_expr)); 11072 CHECK_ALIVE(VisitForTypeOf(sub_expr));
11096 SetSourcePosition(expr->position()); 11073 SetSourcePosition(expr->position());
11097 HValue* value = Pop(); 11074 HValue* value = Pop();
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
11257 return New<HBranch>(graph()->GetConstantTrue()); 11234 return New<HBranch>(graph()->GetConstantTrue());
11258 } 11235 }
11259 // Can we get away with map check and not instance type check? 11236 // Can we get away with map check and not instance type check?
11260 HValue* operand_to_check = 11237 HValue* operand_to_check =
11261 left->block()->block_id() < right->block()->block_id() ? left : right; 11238 left->block()->block_id() < right->block()->block_id() ? left : right;
11262 if (combined_type->IsClass()) { 11239 if (combined_type->IsClass()) {
11263 Handle<Map> map = combined_type->AsClass()->Map(); 11240 Handle<Map> map = combined_type->AsClass()->Map();
11264 AddCheckMap(operand_to_check, map); 11241 AddCheckMap(operand_to_check, map);
11265 HCompareObjectEqAndBranch* result = 11242 HCompareObjectEqAndBranch* result =
11266 New<HCompareObjectEqAndBranch>(left, right); 11243 New<HCompareObjectEqAndBranch>(left, right);
11267 if (is_tracking_positions()) {
11268 result->set_operand_position(zone(), 0, left_position);
11269 result->set_operand_position(zone(), 1, right_position);
11270 }
11271 return result; 11244 return result;
11272 } else { 11245 } else {
11273 BuildCheckHeapObject(operand_to_check); 11246 BuildCheckHeapObject(operand_to_check);
11274 Add<HCheckInstanceType>(operand_to_check, 11247 Add<HCheckInstanceType>(operand_to_check,
11275 HCheckInstanceType::IS_JS_RECEIVER); 11248 HCheckInstanceType::IS_JS_RECEIVER);
11276 HCompareObjectEqAndBranch* result = 11249 HCompareObjectEqAndBranch* result =
11277 New<HCompareObjectEqAndBranch>(left, right); 11250 New<HCompareObjectEqAndBranch>(left, right);
11278 return result; 11251 return result;
11279 } 11252 }
11280 } else { 11253 } else {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
11400 AddSimulate(bailout_id, REMOVABLE_SIMULATE); 11373 AddSimulate(bailout_id, REMOVABLE_SIMULATE);
11401 } 11374 }
11402 } 11375 }
11403 // TODO(jkummerow): Can we make this more efficient? 11376 // TODO(jkummerow): Can we make this more efficient?
11404 HBranch* branch = New<HBranch>(result); 11377 HBranch* branch = New<HBranch>(result);
11405 return branch; 11378 return branch;
11406 } else { 11379 } else {
11407 HCompareNumericAndBranch* result = 11380 HCompareNumericAndBranch* result =
11408 New<HCompareNumericAndBranch>(left, right, op); 11381 New<HCompareNumericAndBranch>(left, right, op);
11409 result->set_observed_input_representation(left_rep, right_rep); 11382 result->set_observed_input_representation(left_rep, right_rep);
11410 if (is_tracking_positions()) {
11411 result->SetOperandPositions(zone(), left_position, right_position);
11412 }
11413 return result; 11383 return result;
11414 } 11384 }
11415 } 11385 }
11416 } 11386 }
11417 11387
11418 11388
11419 void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr, 11389 void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr,
11420 Expression* sub_expr, 11390 Expression* sub_expr,
11421 NilValue nil) { 11391 NilValue nil) {
11422 DCHECK(!HasStackOverflow()); 11392 DCHECK(!HasStackOverflow());
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
12772 } 12742 }
12773 12743
12774 { 12744 {
12775 Tag HIR_tag(this, "HIR"); 12745 Tag HIR_tag(this, "HIR");
12776 for (HInstructionIterator it(current); !it.Done(); it.Advance()) { 12746 for (HInstructionIterator it(current); !it.Done(); it.Advance()) {
12777 HInstruction* instruction = it.Current(); 12747 HInstruction* instruction = it.Current();
12778 int uses = instruction->UseCount(); 12748 int uses = instruction->UseCount();
12779 PrintIndent(); 12749 PrintIndent();
12780 std::ostringstream os; 12750 std::ostringstream os;
12781 os << "0 " << uses << " " << NameOf(instruction) << " " << *instruction; 12751 os << "0 " << uses << " " << NameOf(instruction) << " " << *instruction;
12782 if (instruction->has_position() && instruction->position().raw() != 0) { 12752 if (instruction->has_position()) {
12783 const SourcePosition pos = instruction->position(); 12753 const SourcePosition pos = instruction->position();
12784 os << " pos:"; 12754 os << " pos:";
12785 if (pos.inlining_id() != 0) os << pos.inlining_id() << "_"; 12755 if (pos.InliningId() != SourcePosition::kNotInlined)
12786 os << pos.position(); 12756 os << "inlining(" << pos.InliningId() << "),";
12757 os << pos.ScriptOffset();
12787 } 12758 }
12788 os << " <|@\n"; 12759 os << " <|@\n";
12789 trace_.Add(os.str().c_str()); 12760 trace_.Add(os.str().c_str());
12790 } 12761 }
12791 } 12762 }
12792 12763
12793 12764
12794 if (chunk != NULL) { 12765 if (chunk != NULL) {
12795 Tag LIR_tag(this, "LIR"); 12766 Tag LIR_tag(this, "LIR");
12796 int first_index = current->first_instruction_index(); 12767 int first_index = current->first_instruction_index();
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
12983 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12954 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12984 } 12955 }
12985 12956
12986 #ifdef DEBUG 12957 #ifdef DEBUG
12987 graph_->Verify(false); // No full verify. 12958 graph_->Verify(false); // No full verify.
12988 #endif 12959 #endif
12989 } 12960 }
12990 12961
12991 } // namespace internal 12962 } // namespace internal
12992 } // namespace v8 12963 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698