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

Side by Side Diff: src/compiler.cc

Issue 10831172: Introduced TypeFeedbackId and BailoutId types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporated review feedback. Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler.h ('k') | src/deoptimizer.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) 54 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone)
55 : isolate_(script->GetIsolate()), 55 : isolate_(script->GetIsolate()),
56 flags_(LanguageModeField::encode(CLASSIC_MODE)), 56 flags_(LanguageModeField::encode(CLASSIC_MODE)),
57 function_(NULL), 57 function_(NULL),
58 scope_(NULL), 58 scope_(NULL),
59 global_scope_(NULL), 59 global_scope_(NULL),
60 script_(script), 60 script_(script),
61 extension_(NULL), 61 extension_(NULL),
62 pre_parse_data_(NULL), 62 pre_parse_data_(NULL),
63 osr_ast_id_(AstNode::kNoNumber), 63 osr_ast_id_(BailoutId::None()),
64 zone_(zone), 64 zone_(zone),
65 deferred_handles_(NULL) { 65 deferred_handles_(NULL) {
66 Initialize(BASE); 66 Initialize(BASE);
67 } 67 }
68 68
69 69
70 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, 70 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info,
71 Zone* zone) 71 Zone* zone)
72 : isolate_(shared_info->GetIsolate()), 72 : isolate_(shared_info->GetIsolate()),
73 flags_(LanguageModeField::encode(CLASSIC_MODE) | 73 flags_(LanguageModeField::encode(CLASSIC_MODE) |
74 IsLazy::encode(true)), 74 IsLazy::encode(true)),
75 function_(NULL), 75 function_(NULL),
76 scope_(NULL), 76 scope_(NULL),
77 global_scope_(NULL), 77 global_scope_(NULL),
78 shared_info_(shared_info), 78 shared_info_(shared_info),
79 script_(Handle<Script>(Script::cast(shared_info->script()))), 79 script_(Handle<Script>(Script::cast(shared_info->script()))),
80 extension_(NULL), 80 extension_(NULL),
81 pre_parse_data_(NULL), 81 pre_parse_data_(NULL),
82 osr_ast_id_(AstNode::kNoNumber), 82 osr_ast_id_(BailoutId::None()),
83 zone_(zone), 83 zone_(zone),
84 deferred_handles_(NULL) { 84 deferred_handles_(NULL) {
85 Initialize(BASE); 85 Initialize(BASE);
86 } 86 }
87 87
88 88
89 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) 89 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone)
90 : isolate_(closure->GetIsolate()), 90 : isolate_(closure->GetIsolate()),
91 flags_(LanguageModeField::encode(CLASSIC_MODE) | 91 flags_(LanguageModeField::encode(CLASSIC_MODE) |
92 IsLazy::encode(true)), 92 IsLazy::encode(true)),
93 function_(NULL), 93 function_(NULL),
94 scope_(NULL), 94 scope_(NULL),
95 global_scope_(NULL), 95 global_scope_(NULL),
96 closure_(closure), 96 closure_(closure),
97 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), 97 shared_info_(Handle<SharedFunctionInfo>(closure->shared())),
98 script_(Handle<Script>(Script::cast(shared_info_->script()))), 98 script_(Handle<Script>(Script::cast(shared_info_->script()))),
99 extension_(NULL), 99 extension_(NULL),
100 pre_parse_data_(NULL), 100 pre_parse_data_(NULL),
101 osr_ast_id_(AstNode::kNoNumber), 101 osr_ast_id_(BailoutId::None()),
102 zone_(zone), 102 zone_(zone),
103 deferred_handles_(NULL) { 103 deferred_handles_(NULL) {
104 Initialize(BASE); 104 Initialize(BASE);
105 } 105 }
106 106
107 107
108 CompilationInfo::~CompilationInfo() { 108 CompilationInfo::~CompilationInfo() {
109 delete deferred_handles_; 109 delete deferred_handles_;
110 } 110 }
111 111
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // language, we cannot optimize functions with too many formal parameters 249 // language, we cannot optimize functions with too many formal parameters
250 // or perform on-stack replacement for function with too many 250 // or perform on-stack replacement for function with too many
251 // stack-allocated local variables. 251 // stack-allocated local variables.
252 // 252 //
253 // The encoding is as a signed value, with parameters and receiver using 253 // The encoding is as a signed value, with parameters and receiver using
254 // the negative indices and locals the non-negative ones. 254 // the negative indices and locals the non-negative ones.
255 const int parameter_limit = -LUnallocated::kMinFixedIndex; 255 const int parameter_limit = -LUnallocated::kMinFixedIndex;
256 const int locals_limit = LUnallocated::kMaxFixedIndex; 256 const int locals_limit = LUnallocated::kMaxFixedIndex;
257 Scope* scope = info()->scope(); 257 Scope* scope = info()->scope();
258 if ((scope->num_parameters() + 1) > parameter_limit || 258 if ((scope->num_parameters() + 1) > parameter_limit ||
259 (info()->osr_ast_id() != AstNode::kNoNumber && 259 (!info()->osr_ast_id().IsNone() &&
260 scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit)) { 260 scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit)) {
261 return AbortOptimization(); 261 return AbortOptimization();
262 } 262 }
263 263
264 // Take --hydrogen-filter into account. 264 // Take --hydrogen-filter into account.
265 Handle<String> name = info()->function()->debug_name(); 265 Handle<String> name = info()->function()->debug_name();
266 if (*FLAG_hydrogen_filter != '\0') { 266 if (*FLAG_hydrogen_filter != '\0') {
267 Vector<const char> filter = CStrVector(FLAG_hydrogen_filter); 267 Vector<const char> filter = CStrVector(FLAG_hydrogen_filter);
268 if ((filter[0] == '-' 268 if ((filter[0] == '-'
269 && name->IsEqualTo(filter.SubVector(1, filter.length()))) 269 && name->IsEqualTo(filter.SubVector(1, filter.length())))
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 701
702 if (V8::UseCrankshaft() && 702 if (V8::UseCrankshaft() &&
703 !function.is_null() && 703 !function.is_null() &&
704 !shared->optimization_disabled()) { 704 !shared->optimization_disabled()) {
705 // If we're asked to always optimize, we compile the optimized 705 // If we're asked to always optimize, we compile the optimized
706 // version of the function right away - unless the debugger is 706 // version of the function right away - unless the debugger is
707 // active as it makes no sense to compile optimized code then. 707 // active as it makes no sense to compile optimized code then.
708 if (FLAG_always_opt && 708 if (FLAG_always_opt &&
709 !Isolate::Current()->DebuggerHasBreakPoints()) { 709 !Isolate::Current()->DebuggerHasBreakPoints()) {
710 CompilationInfoWithZone optimized(function); 710 CompilationInfoWithZone optimized(function);
711 optimized.SetOptimizing(AstNode::kNoNumber); 711 optimized.SetOptimizing(BailoutId::None());
712 return Compiler::CompileLazy(&optimized); 712 return Compiler::CompileLazy(&optimized);
713 } 713 }
714 } 714 }
715 return true; 715 return true;
716 } 716 }
717 717
718 718
719 static void InstallCodeCommon(CompilationInfo* info) { 719 static void InstallCodeCommon(CompilationInfo* info) {
720 Handle<SharedFunctionInfo> shared = info->shared_info(); 720 Handle<SharedFunctionInfo> shared = info->shared_info();
721 Handle<Code> code = info->code(); 721 Handle<Code> code = info->code();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 return; 830 return;
831 } 831 }
832 832
833 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); 833 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure));
834 VMState state(isolate, PARALLEL_COMPILER_PROLOGUE); 834 VMState state(isolate, PARALLEL_COMPILER_PROLOGUE);
835 PostponeInterruptsScope postpone(isolate); 835 PostponeInterruptsScope postpone(isolate);
836 836
837 Handle<SharedFunctionInfo> shared = info->shared_info(); 837 Handle<SharedFunctionInfo> shared = info->shared_info();
838 int compiled_size = shared->end_position() - shared->start_position(); 838 int compiled_size = shared->end_position() - shared->start_position();
839 isolate->counters()->total_compile_size()->Increment(compiled_size); 839 isolate->counters()->total_compile_size()->Increment(compiled_size);
840 info->SetOptimizing(AstNode::kNoNumber); 840 info->SetOptimizing(BailoutId::None());
841 841
842 { 842 {
843 CompilationHandleScope handle_scope(*info); 843 CompilationHandleScope handle_scope(*info);
844 844
845 if (InstallCodeFromOptimizedCodeMap(*info)) return; 845 if (InstallCodeFromOptimizedCodeMap(*info)) return;
846 846
847 if (ParserApi::Parse(*info, kNoParsingFlags)) { 847 if (ParserApi::Parse(*info, kNoParsingFlags)) {
848 LanguageMode language_mode = info->function()->language_mode(); 848 LanguageMode language_mode = info->function()->language_mode();
849 info->SetLanguageMode(language_mode); 849 info->SetLanguageMode(language_mode);
850 shared->set_language_mode(language_mode); 850 shared->set_language_mode(language_mode);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 } 1027 }
1028 } 1028 }
1029 1029
1030 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 1030 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
1031 Handle<Script>(info->script()), 1031 Handle<Script>(info->script()),
1032 Handle<Code>(info->code()), 1032 Handle<Code>(info->code()),
1033 info)); 1033 info));
1034 } 1034 }
1035 1035
1036 } } // namespace v8::internal 1036 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/deoptimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698