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

Side by Side Diff: src/codegen.cc

Issue 11638037: Remove most uses of StringInputBuffer (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: cleanup Created 7 years, 12 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/api.cc ('k') | src/isolate.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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 bool print_code = Isolate::Current()->bootstrapper()->IsActive() 124 bool print_code = Isolate::Current()->bootstrapper()->IsActive()
125 ? FLAG_print_builtin_code 125 ? FLAG_print_builtin_code
126 : (FLAG_print_code || (info->IsOptimizing() && FLAG_print_opt_code)); 126 : (FLAG_print_code || (info->IsOptimizing() && FLAG_print_opt_code));
127 if (print_code) { 127 if (print_code) {
128 // Print the source code if available. 128 // Print the source code if available.
129 FunctionLiteral* function = info->function(); 129 FunctionLiteral* function = info->function();
130 if (code->kind() != Code::COMPILED_STUB) { 130 if (code->kind() != Code::COMPILED_STUB) {
131 Handle<Script> script = info->script(); 131 Handle<Script> script = info->script();
132 if (!script->IsUndefined() && !script->source()->IsUndefined()) { 132 if (!script->IsUndefined() && !script->source()->IsUndefined()) {
133 PrintF("--- Raw source ---\n"); 133 PrintF("--- Raw source ---\n");
134 StringInputBuffer stream(String::cast(script->source())); 134 ConsStringIteratorOp op;
135 stream.Seek(function->start_position()); 135 StringCharacterStream stream(String::cast(script->source()),
136 &op,
137 function->start_position());
136 // fun->end_position() points to the last character in the stream. We 138 // fun->end_position() points to the last character in the stream. We
137 // need to compensate by adding one to calculate the length. 139 // need to compensate by adding one to calculate the length.
138 int source_len = 140 int source_len =
139 function->end_position() - function->start_position() + 1; 141 function->end_position() - function->start_position() + 1;
140 for (int i = 0; i < source_len; i++) { 142 for (int i = 0; i < source_len; i++) {
141 if (stream.has_more()) PrintF("%c", stream.GetNext()); 143 if (stream.HasMore()) PrintF("%c", stream.GetNext());
142 } 144 }
143 PrintF("\n\n"); 145 PrintF("\n\n");
144 } 146 }
145 } 147 }
146 if (info->IsOptimizing()) { 148 if (info->IsOptimizing()) {
147 if (FLAG_print_unopt_code) { 149 if (FLAG_print_unopt_code) {
148 PrintF("--- Unoptimized code ---\n"); 150 PrintF("--- Unoptimized code ---\n");
149 info->closure()->shared()->code()->Disassemble( 151 info->closure()->shared()->code()->Disassemble(
150 *function->debug_name()->ToCString()); 152 *function->debug_name()->ToCString());
151 } 153 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 ASSERT(result_size_ == 1 || result_size_ == 2); 218 ASSERT(result_size_ == 1 || result_size_ == 2);
217 #ifdef _WIN64 219 #ifdef _WIN64
218 return result | ((result_size_ == 1) ? 0 : 2); 220 return result | ((result_size_ == 1) ? 0 : 2);
219 #else 221 #else
220 return result; 222 return result;
221 #endif 223 #endif
222 } 224 }
223 225
224 226
225 } } // namespace v8::internal 227 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698