OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
6 | 6 |
7 #include "src/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
404 Node* token = commands_->RecordCommand(cmd, target, *value); | 404 Node* token = commands_->RecordCommand(cmd, target, *value); |
405 control_->LeaveTry(token, *value); | 405 control_->LeaveTry(token, *value); |
406 return true; | 406 return true; |
407 } | 407 } |
408 | 408 |
409 private: | 409 private: |
410 DeferredCommands* commands_; | 410 DeferredCommands* commands_; |
411 TryFinallyBuilder* control_; | 411 TryFinallyBuilder* control_; |
412 }; | 412 }; |
413 | 413 |
414 | |
415 AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info, | 414 AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info, |
416 JSGraph* jsgraph, LoopAssignmentAnalysis* loop, | 415 JSGraph* jsgraph, float invocation_frequency, |
416 LoopAssignmentAnalysis* loop, | |
417 TypeHintAnalysis* type_hint_analysis) | 417 TypeHintAnalysis* type_hint_analysis) |
418 : isolate_(info->isolate()), | 418 : isolate_(info->isolate()), |
419 local_zone_(local_zone), | 419 local_zone_(local_zone), |
420 info_(info), | 420 info_(info), |
421 jsgraph_(jsgraph), | 421 jsgraph_(jsgraph), |
422 invocation_frequency_(invocation_frequency), | |
422 environment_(nullptr), | 423 environment_(nullptr), |
423 ast_context_(nullptr), | 424 ast_context_(nullptr), |
424 globals_(0, local_zone), | 425 globals_(0, local_zone), |
425 execution_control_(nullptr), | 426 execution_control_(nullptr), |
426 execution_context_(nullptr), | 427 execution_context_(nullptr), |
427 try_nesting_level_(0), | 428 try_nesting_level_(0), |
428 input_buffer_size_(0), | 429 input_buffer_size_(0), |
429 input_buffer_(nullptr), | 430 input_buffer_(nullptr), |
430 exit_controls_(local_zone), | 431 exit_controls_(local_zone), |
431 loop_assignment_analysis_(loop), | 432 loop_assignment_analysis_(loop), |
(...skipping 2665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3097 if (s == variable->scope()) break; | 3098 if (s == variable->scope()) break; |
3098 } | 3099 } |
3099 return check_depths; | 3100 return check_depths; |
3100 } | 3101 } |
3101 | 3102 |
3102 float AstGraphBuilder::ComputeCallFrequency(FeedbackVectorSlot slot) const { | 3103 float AstGraphBuilder::ComputeCallFrequency(FeedbackVectorSlot slot) const { |
3103 if (slot.IsInvalid()) return 0.0f; | 3104 if (slot.IsInvalid()) return 0.0f; |
3104 Handle<TypeFeedbackVector> feedback_vector( | 3105 Handle<TypeFeedbackVector> feedback_vector( |
3105 info()->closure()->feedback_vector(), isolate()); | 3106 info()->closure()->feedback_vector(), isolate()); |
3106 CallICNexus nexus(feedback_vector, slot); | 3107 CallICNexus nexus(feedback_vector, slot); |
3107 return nexus.ExtractCallCount(); | 3108 double const invocation_count = feedback_vector->invocation_count(); |
3109 double const call_count = nexus.ExtractCallCount(); | |
3110 return static_cast<float>(call_count / invocation_count) * | |
3111 invocation_frequency_; | |
mvstanton
2016/09/14 09:26:09
How about giving the CallICNexus responsibility fo
Benedikt Meurer
2016/09/14 10:55:44
Done.
| |
3108 } | 3112 } |
3109 | 3113 |
3110 Node* AstGraphBuilder::ProcessArguments(const Operator* op, int arity) { | 3114 Node* AstGraphBuilder::ProcessArguments(const Operator* op, int arity) { |
3111 DCHECK(environment()->stack_height() >= arity); | 3115 DCHECK(environment()->stack_height() >= arity); |
3112 Node** all = info()->zone()->NewArray<Node*>(arity); | 3116 Node** all = info()->zone()->NewArray<Node*>(arity); |
3113 for (int i = arity - 1; i >= 0; --i) { | 3117 for (int i = arity - 1; i >= 0; --i) { |
3114 all[i] = environment()->Pop(); | 3118 all[i] = environment()->Pop(); |
3115 } | 3119 } |
3116 Node* value = NewNode(op, arity, all); | 3120 Node* value = NewNode(op, arity, all); |
3117 return value; | 3121 return value; |
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4319 // Phi does not exist yet, introduce one. | 4323 // Phi does not exist yet, introduce one. |
4320 value = NewPhi(inputs, value, control); | 4324 value = NewPhi(inputs, value, control); |
4321 value->ReplaceInput(inputs - 1, other); | 4325 value->ReplaceInput(inputs - 1, other); |
4322 } | 4326 } |
4323 return value; | 4327 return value; |
4324 } | 4328 } |
4325 | 4329 |
4326 } // namespace compiler | 4330 } // namespace compiler |
4327 } // namespace internal | 4331 } // namespace internal |
4328 } // namespace v8 | 4332 } // namespace v8 |
OLD | NEW |