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

Side by Side Diff: src/compiler.cc

Issue 6580038: [Isolates] Merge from bleeding_edge, revisions 5934-6100. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 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/codegen.cc ('k') | src/counters.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 #else 114 #else
115 return FLAG_always_full_compiler; 115 return FLAG_always_full_compiler;
116 #endif 116 #endif
117 } 117 }
118 118
119 119
120 static void FinishOptimization(Handle<JSFunction> function, int64_t start) { 120 static void FinishOptimization(Handle<JSFunction> function, int64_t start) {
121 int opt_count = function->shared()->opt_count(); 121 int opt_count = function->shared()->opt_count();
122 function->shared()->set_opt_count(opt_count + 1); 122 function->shared()->set_opt_count(opt_count + 1);
123 if (!FLAG_trace_opt) return; 123 double ms = static_cast<double>(OS::Ticks() - start) / 1000;
124 if (FLAG_trace_opt) {
125 PrintF("[optimizing: ");
126 function->PrintName();
127 PrintF(" / %" V8PRIxPTR, reinterpret_cast<intptr_t>(*function));
128 PrintF(" - took %0.3f ms]\n", ms);
129 }
130 if (FLAG_trace_opt_stats) {
131 static double compilation_time = 0.0;
132 static int compiled_functions = 0;
133 static int code_size = 0;
124 134
125 double ms = static_cast<double>(OS::Ticks() - start) / 1000; 135 compilation_time += ms;
126 PrintF("[optimizing: "); 136 compiled_functions++;
127 function->PrintName(); 137 code_size += function->shared()->SourceSize();
128 PrintF(" / %" V8PRIxPTR, reinterpret_cast<intptr_t>(*function)); 138 PrintF("Compiled: %d functions with %d byte source size in %fms.\n",
129 PrintF(" - took %0.3f ms]\n", ms); 139 compiled_functions,
140 code_size,
141 compilation_time);
142 }
130 } 143 }
131 144
132 145
133 static void AbortAndDisable(CompilationInfo* info) { 146 static void AbortAndDisable(CompilationInfo* info) {
134 // Disable optimization for the shared function info and mark the 147 // Disable optimization for the shared function info and mark the
135 // code as non-optimizable. The marker on the shared function info 148 // code as non-optimizable. The marker on the shared function info
136 // is there because we flush non-optimized code thereby loosing the 149 // is there because we flush non-optimized code thereby loosing the
137 // non-optimizable information for the code. When the code is 150 // non-optimizable information for the code. When the code is
138 // regenerated and set on the shared function info it is marked as 151 // regenerated and set on the shared function info it is marked as
139 // non-optimizable if optimization is disabled for the shared 152 // non-optimizable if optimization is disabled for the shared
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 // the script. 477 // the script.
465 // Building preparse data that is only used immediately after is only a 478 // Building preparse data that is only used immediately after is only a
466 // saving if we might skip building the AST for lazily compiled functions. 479 // saving if we might skip building the AST for lazily compiled functions.
467 // I.e., preparse data isn't relevant when the lazy flag is off, and 480 // I.e., preparse data isn't relevant when the lazy flag is off, and
468 // for small sources, odds are that there aren't many functions 481 // for small sources, odds are that there aren't many functions
469 // that would be compiled lazily anyway, so we skip the preparse step 482 // that would be compiled lazily anyway, so we skip the preparse step
470 // in that case too. 483 // in that case too.
471 ScriptDataImpl* pre_data = input_pre_data; 484 ScriptDataImpl* pre_data = input_pre_data;
472 if (pre_data == NULL 485 if (pre_data == NULL
473 && source_length >= FLAG_min_preparse_length) { 486 && source_length >= FLAG_min_preparse_length) {
474 pre_data = ParserApi::PartialPreParse(source, NULL, extension); 487 if (source->IsExternalTwoByteString()) {
488 ExternalTwoByteStringUC16CharacterStream stream(
489 Handle<ExternalTwoByteString>::cast(source), 0, source->length());
490 pre_data = ParserApi::PartialPreParse(&stream, extension);
491 } else {
492 GenericStringUC16CharacterStream stream(source, 0, source->length());
493 pre_data = ParserApi::PartialPreParse(&stream, extension);
494 }
475 } 495 }
476 496
477 // Create a script object describing the script to be compiled. 497 // Create a script object describing the script to be compiled.
478 Handle<Script> script = FACTORY->NewScript(source); 498 Handle<Script> script = FACTORY->NewScript(source);
479 if (natives == NATIVES_CODE) { 499 if (natives == NATIVES_CODE) {
480 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); 500 script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
481 } 501 }
482 if (!script_name.is_null()) { 502 if (!script_name.is_null()) {
483 script->set_name(*script_name); 503 script->set_name(*script_name);
484 script->set_line_offset(Smi::FromInt(line_offset)); 504 script->set_line_offset(Smi::FromInt(line_offset));
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 *code, 785 *code,
766 *name)); 786 *name));
767 OPROFILE(CreateNativeCodeRegion(*name, 787 OPROFILE(CreateNativeCodeRegion(*name,
768 code->instruction_start(), 788 code->instruction_start(),
769 code->instruction_size())); 789 code->instruction_size()));
770 } 790 }
771 } 791 }
772 } 792 }
773 793
774 } } // namespace v8::internal 794 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698