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

Side by Side Diff: src/codegen.cc

Issue 10701054: Enable stub generation using Hydrogen/Lithium (again) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years 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
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 114
115 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { 115 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
116 #ifdef ENABLE_DISASSEMBLER 116 #ifdef ENABLE_DISASSEMBLER
117 bool print_code = Isolate::Current()->bootstrapper()->IsActive() 117 bool print_code = Isolate::Current()->bootstrapper()->IsActive()
118 ? FLAG_print_builtin_code 118 ? FLAG_print_builtin_code
119 : (FLAG_print_code || (info->IsOptimizing() && FLAG_print_opt_code)); 119 : (FLAG_print_code || (info->IsOptimizing() && FLAG_print_opt_code));
120 if (print_code) { 120 if (print_code) {
121 // Print the source code if available. 121 // Print the source code if available.
122 FunctionLiteral* function = info->function(); 122 FunctionLiteral* function = info->function();
123 Handle<Script> script = info->script(); 123 if (code->kind() != Code::COMPILED_STUB) {
124 if (!script->IsUndefined() && !script->source()->IsUndefined()) { 124 Handle<Script> script = info->script();
125 PrintF("--- Raw source ---\n"); 125 if (!script->IsUndefined() && !script->source()->IsUndefined()) {
126 StringInputBuffer stream(String::cast(script->source())); 126 PrintF("--- Raw source ---\n");
127 stream.Seek(function->start_position()); 127 StringInputBuffer stream(String::cast(script->source()));
128 // fun->end_position() points to the last character in the stream. We 128 stream.Seek(function->start_position());
129 // need to compensate by adding one to calculate the length. 129 // fun->end_position() points to the last character in the stream. We
130 int source_len = 130 // need to compensate by adding one to calculate the length.
131 function->end_position() - function->start_position() + 1; 131 int source_len =
132 for (int i = 0; i < source_len; i++) { 132 function->end_position() - function->start_position() + 1;
133 if (stream.has_more()) PrintF("%c", stream.GetNext()); 133 for (int i = 0; i < source_len; i++) {
134 if (stream.has_more()) PrintF("%c", stream.GetNext());
135 }
136 PrintF("\n\n");
134 } 137 }
135 PrintF("\n\n");
136 } 138 }
137 if (info->IsOptimizing()) { 139 if (info->IsOptimizing()) {
138 if (FLAG_print_unopt_code) { 140 if (FLAG_print_unopt_code) {
139 PrintF("--- Unoptimized code ---\n"); 141 PrintF("--- Unoptimized code ---\n");
140 info->closure()->shared()->code()->Disassemble( 142 info->closure()->shared()->code()->Disassemble(
141 *function->debug_name()->ToCString()); 143 *function->debug_name()->ToCString());
142 } 144 }
143 PrintF("--- Optimized code ---\n"); 145 PrintF("--- Optimized code ---\n");
144 } else { 146 } else {
145 PrintF("--- Code ---\n"); 147 PrintF("--- Code ---\n");
146 } 148 }
147 code->Disassemble(*function->debug_name()->ToCString()); 149 if (info->IsStub()) {
150 code->Disassemble("");
Jakob Kummerow 2012/11/28 16:28:22 use info->stub()->Major()?
danno 2012/11/30 16:23:24 Done.
151 } else {
152 code->Disassemble(*function->debug_name()->ToCString());
153 }
148 } 154 }
149 #endif // ENABLE_DISASSEMBLER 155 #endif // ENABLE_DISASSEMBLER
150 } 156 }
151 157
152 158
153 bool CodeGenerator::ShouldGenerateLog(Expression* type) { 159 bool CodeGenerator::ShouldGenerateLog(Expression* type) {
154 ASSERT(type != NULL); 160 ASSERT(type != NULL);
155 Isolate* isolate = Isolate::Current(); 161 Isolate* isolate = Isolate::Current();
156 if (!isolate->logger()->is_logging() && !CpuProfiler::is_profiling(isolate)) { 162 if (!isolate->logger()->is_logging() && !CpuProfiler::is_profiling(isolate)) {
157 return false; 163 return false;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 ASSERT(result_size_ == 1 || result_size_ == 2); 208 ASSERT(result_size_ == 1 || result_size_ == 2);
203 #ifdef _WIN64 209 #ifdef _WIN64
204 return result | ((result_size_ == 1) ? 0 : 2); 210 return result | ((result_size_ == 1) ? 0 : 2);
205 #else 211 #else
206 return result; 212 return result;
207 #endif 213 #endif
208 } 214 }
209 215
210 216
211 } } // namespace v8::internal 217 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698