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

Side by Side Diff: samples/shell.cc

Issue 6879009: Support Float64Arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 9 years, 8 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 | « include/v8.h ('k') | src/api.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 v8::Handle<v8::Value> Load(const v8::Arguments& args); 65 v8::Handle<v8::Value> Load(const v8::Arguments& args);
66 v8::Handle<v8::Value> Quit(const v8::Arguments& args); 66 v8::Handle<v8::Value> Quit(const v8::Arguments& args);
67 v8::Handle<v8::Value> Version(const v8::Arguments& args); 67 v8::Handle<v8::Value> Version(const v8::Arguments& args);
68 v8::Handle<v8::Value> Int8Array(const v8::Arguments& args); 68 v8::Handle<v8::Value> Int8Array(const v8::Arguments& args);
69 v8::Handle<v8::Value> Uint8Array(const v8::Arguments& args); 69 v8::Handle<v8::Value> Uint8Array(const v8::Arguments& args);
70 v8::Handle<v8::Value> Int16Array(const v8::Arguments& args); 70 v8::Handle<v8::Value> Int16Array(const v8::Arguments& args);
71 v8::Handle<v8::Value> Uint16Array(const v8::Arguments& args); 71 v8::Handle<v8::Value> Uint16Array(const v8::Arguments& args);
72 v8::Handle<v8::Value> Int32Array(const v8::Arguments& args); 72 v8::Handle<v8::Value> Int32Array(const v8::Arguments& args);
73 v8::Handle<v8::Value> Uint32Array(const v8::Arguments& args); 73 v8::Handle<v8::Value> Uint32Array(const v8::Arguments& args);
74 v8::Handle<v8::Value> Float32Array(const v8::Arguments& args); 74 v8::Handle<v8::Value> Float32Array(const v8::Arguments& args);
75 v8::Handle<v8::Value> Float64Array(const v8::Arguments& args);
75 v8::Handle<v8::Value> PixelArray(const v8::Arguments& args); 76 v8::Handle<v8::Value> PixelArray(const v8::Arguments& args);
76 v8::Handle<v8::String> ReadFile(const char* name); 77 v8::Handle<v8::String> ReadFile(const char* name);
77 void ReportException(v8::TryCatch* handler); 78 void ReportException(v8::TryCatch* handler);
78 79
79 80
80 static bool last_run = true; 81 static bool last_run = true;
81 82
82 class SourceGroup { 83 class SourceGroup {
83 public: 84 public:
84 SourceGroup() : 85 SourceGroup() :
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 global->Set(v8::String::New("Int16Array"), 353 global->Set(v8::String::New("Int16Array"),
353 v8::FunctionTemplate::New(Int16Array)); 354 v8::FunctionTemplate::New(Int16Array));
354 global->Set(v8::String::New("Uint16Array"), 355 global->Set(v8::String::New("Uint16Array"),
355 v8::FunctionTemplate::New(Uint16Array)); 356 v8::FunctionTemplate::New(Uint16Array));
356 global->Set(v8::String::New("Int32Array"), 357 global->Set(v8::String::New("Int32Array"),
357 v8::FunctionTemplate::New(Int32Array)); 358 v8::FunctionTemplate::New(Int32Array));
358 global->Set(v8::String::New("Uint32Array"), 359 global->Set(v8::String::New("Uint32Array"),
359 v8::FunctionTemplate::New(Uint32Array)); 360 v8::FunctionTemplate::New(Uint32Array));
360 global->Set(v8::String::New("Float32Array"), 361 global->Set(v8::String::New("Float32Array"),
361 v8::FunctionTemplate::New(Float32Array)); 362 v8::FunctionTemplate::New(Float32Array));
363 global->Set(v8::String::New("Float64Array"),
364 v8::FunctionTemplate::New(Float64Array));
362 global->Set(v8::String::New("PixelArray"), 365 global->Set(v8::String::New("PixelArray"),
363 v8::FunctionTemplate::New(PixelArray)); 366 v8::FunctionTemplate::New(PixelArray));
364 367
365 return v8::Context::New(NULL, global); 368 return v8::Context::New(NULL, global);
366 } 369 }
367 370
368 371
369 // The callback that is invoked by v8 whenever the JavaScript 'print' 372 // The callback that is invoked by v8 whenever the JavaScript 'print'
370 // function is called. Prints its arguments on stdout separated by 373 // function is called. Prints its arguments on stdout separated by
371 // spaces and ending with a newline. 374 // spaces and ending with a newline.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 sizeof(uint32_t)); 508 sizeof(uint32_t));
506 } 509 }
507 510
508 511
509 v8::Handle<v8::Value> Float32Array(const v8::Arguments& args) { 512 v8::Handle<v8::Value> Float32Array(const v8::Arguments& args) {
510 return CreateExternalArray(args, v8::kExternalFloatArray, 513 return CreateExternalArray(args, v8::kExternalFloatArray,
511 sizeof(float)); // NOLINT 514 sizeof(float)); // NOLINT
512 } 515 }
513 516
514 517
518 v8::Handle<v8::Value> Float64Array(const v8::Arguments& args) {
519 return CreateExternalArray(args, v8::kExternalDoubleArray,
520 sizeof(double)); // NOLINT
521 }
522
523
515 v8::Handle<v8::Value> PixelArray(const v8::Arguments& args) { 524 v8::Handle<v8::Value> PixelArray(const v8::Arguments& args) {
516 return CreateExternalArray(args, v8::kExternalPixelArray, sizeof(uint8_t)); 525 return CreateExternalArray(args, v8::kExternalPixelArray, sizeof(uint8_t));
517 } 526 }
518 527
519 528
520 // Reads a file into a v8 string. 529 // Reads a file into a v8 string.
521 v8::Handle<v8::String> ReadFile(const char* name) { 530 v8::Handle<v8::String> ReadFile(const char* name) {
522 FILE* file = fopen(name, "rb"); 531 FILE* file = fopen(name, "rb");
523 if (file == NULL) return v8::Handle<v8::String>(); 532 if (file == NULL) return v8::Handle<v8::String>();
524 533
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 printf("^"); 634 printf("^");
626 } 635 }
627 printf("\n"); 636 printf("\n");
628 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); 637 v8::String::Utf8Value stack_trace(try_catch->StackTrace());
629 if (stack_trace.length() > 0) { 638 if (stack_trace.length() > 0) {
630 const char* stack_trace_string = ToCString(stack_trace); 639 const char* stack_trace_string = ToCString(stack_trace);
631 printf("%s\n", stack_trace_string); 640 printf("%s\n", stack_trace_string);
632 } 641 }
633 } 642 }
634 } 643 }
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698