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

Side by Side Diff: runtime/vm/intermediate_language.cc

Issue 2877713003: Eliminated with_checks variable (Closed)
Patch Set: Removed TODO Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_dbc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/constant_propagator.h" 10 #include "vm/constant_propagator.h"
(...skipping 3327 matching lines...) Expand 10 before | Expand all | Expand 10 after
3338 3338
3339 intptr_t PolymorphicInstanceCallInstr::CallCount() const { 3339 intptr_t PolymorphicInstanceCallInstr::CallCount() const {
3340 return targets().AggregateCallCount(); 3340 return targets().AggregateCallCount();
3341 } 3341 }
3342 3342
3343 3343
3344 // DBC does not support optimizing compiler and thus doesn't emit 3344 // DBC does not support optimizing compiler and thus doesn't emit
3345 // PolymorphicInstanceCallInstr. 3345 // PolymorphicInstanceCallInstr.
3346 #if !defined(TARGET_ARCH_DBC) 3346 #if !defined(TARGET_ARCH_DBC)
3347 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3347 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3348 if (!with_checks()) {
3349 ASSERT(targets().HasSingleTarget());
3350 const Function& target = targets().FirstTarget();
3351 compiler->GenerateStaticCall(deopt_id(), instance_call()->token_pos(),
3352 target, instance_call()->ArgumentCount(),
3353 instance_call()->argument_names(), locs(),
3354 ICData::Handle());
3355 return;
3356 }
3357
3358 compiler->EmitPolymorphicInstanceCall( 3348 compiler->EmitPolymorphicInstanceCall(
3359 targets_, *instance_call(), instance_call()->ArgumentCount(), 3349 targets_, *instance_call(), instance_call()->ArgumentCount(),
3360 instance_call()->argument_names(), deopt_id(), 3350 instance_call()->argument_names(), deopt_id(),
3361 instance_call()->token_pos(), locs(), complete(), total_call_count()); 3351 instance_call()->token_pos(), locs(), complete(), total_call_count());
3362 } 3352 }
3363 #endif 3353 #endif
3364 3354
3365 3355
3366 RawType* PolymorphicInstanceCallInstr::ComputeRuntimeType( 3356 RawType* PolymorphicInstanceCallInstr::ComputeRuntimeType(
3367 const CallTargets& targets) { 3357 const CallTargets& targets) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
3408 const CallTargets* new_target = 3398 const CallTargets* new_target =
3409 FlowGraphCompiler::ResolveCallTargetsForReceiverCid( 3399 FlowGraphCompiler::ResolveCallTargetsForReceiverCid(
3410 receiver_cid, 3400 receiver_cid,
3411 String::Handle(flow_graph->zone(), ic_data()->target_name()), 3401 String::Handle(flow_graph->zone(), ic_data()->target_name()),
3412 Array::Handle(flow_graph->zone(), ic_data()->arguments_descriptor())); 3402 Array::Handle(flow_graph->zone(), ic_data()->arguments_descriptor()));
3413 if (new_target == NULL) { 3403 if (new_target == NULL) {
3414 // No specialization. 3404 // No specialization.
3415 return this; 3405 return this;
3416 } 3406 }
3417 3407
3418 const bool with_checks = false; 3408 ASSERT(new_target->HasSingleTarget());
3419 const bool complete = false; 3409 const Function& target = new_target->FirstTarget();
3420 PolymorphicInstanceCallInstr* specialized = new PolymorphicInstanceCallInstr( 3410 StaticCallInstr* specialized =
3421 this, *new_target, with_checks, complete); 3411 StaticCallInstr::FromCall(flow_graph->zone(), this, target);
3422 flow_graph->InsertBefore(this, specialized, env(), FlowGraph::kValue); 3412 flow_graph->InsertBefore(this, specialized, env(), FlowGraph::kValue);
3423 return specialized; 3413 return specialized;
3424 } 3414 }
3425 3415
3426 3416
3427 Definition* PolymorphicInstanceCallInstr::Canonicalize(FlowGraph* flow_graph) { 3417 Definition* PolymorphicInstanceCallInstr::Canonicalize(FlowGraph* flow_graph) {
3428 if (!IsSureToCallSingleRecognizedTarget()) { 3418 if (!IsSureToCallSingleRecognizedTarget()) {
3429 return this; 3419 return this;
3430 } 3420 }
3431 3421
3432 const Function& target = targets().FirstTarget(); 3422 const Function& target = targets().FirstTarget();
3433 if (target.recognized_kind() == MethodRecognizer::kObjectRuntimeType) { 3423 if (target.recognized_kind() == MethodRecognizer::kObjectRuntimeType) {
3434 const AbstractType& type = 3424 const AbstractType& type =
3435 AbstractType::Handle(ComputeRuntimeType(targets_)); 3425 AbstractType::Handle(ComputeRuntimeType(targets_));
3436 if (!type.IsNull()) { 3426 if (!type.IsNull()) {
3437 return flow_graph->GetConstant(type); 3427 return flow_graph->GetConstant(type);
3438 } 3428 }
3439 } 3429 }
3440 3430
3441 return this; 3431 return this;
3442 } 3432 }
3443 3433
3444 3434
3445 bool PolymorphicInstanceCallInstr::IsSureToCallSingleRecognizedTarget() const { 3435 bool PolymorphicInstanceCallInstr::IsSureToCallSingleRecognizedTarget() const {
3446 if (FLAG_precompiled_mode && with_checks()) return false; 3436 if (FLAG_precompiled_mode && !complete()) return false;
3447 return targets_.HasSingleRecognizedTarget(); 3437 return targets_.HasSingleRecognizedTarget();
3448 } 3438 }
3449 3439
3450 3440
3451 Definition* StaticCallInstr::Canonicalize(FlowGraph* flow_graph) { 3441 Definition* StaticCallInstr::Canonicalize(FlowGraph* flow_graph) {
3452 if (!FLAG_precompiled_mode) { 3442 if (!FLAG_precompiled_mode) {
3453 return this; 3443 return this;
3454 } 3444 }
3455 3445
3456 if (function().recognized_kind() == MethodRecognizer::kObjectRuntimeType) { 3446 if (function().recognized_kind() == MethodRecognizer::kObjectRuntimeType) {
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
4183 "native function '%s' (%" Pd " arguments) cannot be found", 4173 "native function '%s' (%" Pd " arguments) cannot be found",
4184 native_name().ToCString(), function().NumParameters()); 4174 native_name().ToCString(), function().NumParameters());
4185 } 4175 }
4186 set_is_auto_scope(auto_setup_scope); 4176 set_is_auto_scope(auto_setup_scope);
4187 set_native_c_function(native_function); 4177 set_native_c_function(native_function);
4188 } 4178 }
4189 4179
4190 #undef __ 4180 #undef __
4191 4181
4192 } // namespace dart 4182 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698