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

Side by Side Diff: samples/shell.cc

Issue 7830036: Optimize isFinite and isNaN. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Made the change general by moving putting it in the NUMBER_IS_FINITE macro. Created 9 years, 3 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 | « no previous file | src/arm/code-stubs-arm.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 return 0; 243 return 0;
244 } 244 }
245 245
246 246
247 // The read-eval-execute loop of the shell. 247 // The read-eval-execute loop of the shell.
248 void RunShell(v8::Handle<v8::Context> context) { 248 void RunShell(v8::Handle<v8::Context> context) {
249 printf("V8 version %s [sample shell]\n", v8::V8::GetVersion()); 249 printf("V8 version %s [sample shell]\n", v8::V8::GetVersion());
250 static const int kBufferSize = 256; 250 static const int kBufferSize = 256;
251 // Enter the execution environment before evaluating any code. 251 // Enter the execution environment before evaluating any code.
252 v8::Context::Scope context_scope(context); 252 v8::Context::Scope context_scope(context);
253 v8::Local<v8::String> name(v8::String::New("(shell)"));
254 while (true) { 253 while (true) {
255 char buffer[kBufferSize]; 254 char buffer[kBufferSize];
256 printf("> "); 255 printf("> ");
257 char* str = fgets(buffer, kBufferSize, stdin); 256 char* str = fgets(buffer, kBufferSize, stdin);
258 if (str == NULL) break; 257 if (str == NULL) break;
259 v8::HandleScope handle_scope; 258 v8::HandleScope handle_scope;
260 ExecuteString(v8::String::New(str), name, true, true); 259 ExecuteString(v8::String::New(str),
260 v8::String::New("(shell)"),
261 true,
262 true);
261 } 263 }
262 printf("\n"); 264 printf("\n");
263 } 265 }
264 266
265 267
266 // Executes a string within the current v8 context. 268 // Executes a string within the current v8 context.
267 bool ExecuteString(v8::Handle<v8::String> source, 269 bool ExecuteString(v8::Handle<v8::String> source,
268 v8::Handle<v8::Value> name, 270 v8::Handle<v8::Value> name,
269 bool print_result, 271 bool print_result,
270 bool report_exceptions) { 272 bool report_exceptions) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 printf("^"); 330 printf("^");
329 } 331 }
330 printf("\n"); 332 printf("\n");
331 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); 333 v8::String::Utf8Value stack_trace(try_catch->StackTrace());
332 if (stack_trace.length() > 0) { 334 if (stack_trace.length() > 0) {
333 const char* stack_trace_string = ToCString(stack_trace); 335 const char* stack_trace_string = ToCString(stack_trace);
334 printf("%s\n", stack_trace_string); 336 printf("%s\n", stack_trace_string);
335 } 337 }
336 } 338 }
337 } 339 }
OLDNEW
« no previous file with comments | « no previous file | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698