OLD | NEW |
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 virtual void* Allocate(size_t length) { | 68 virtual void* Allocate(size_t length) { |
69 void* data = AllocateUninitialized(length); | 69 void* data = AllocateUninitialized(length); |
70 return data == NULL ? data : memset(data, 0, length); | 70 return data == NULL ? data : memset(data, 0, length); |
71 } | 71 } |
72 virtual void* AllocateUninitialized(size_t length) { return malloc(length); } | 72 virtual void* AllocateUninitialized(size_t length) { return malloc(length); } |
73 virtual void Free(void* data, size_t) { free(data); } | 73 virtual void Free(void* data, size_t) { free(data); } |
74 }; | 74 }; |
75 | 75 |
76 | 76 |
77 int main(int argc, char* argv[]) { | 77 int main(int argc, char* argv[]) { |
78 v8::V8::InitializeICU(); | 78 v8::V8::InitializeICUDefaultLocation(argv[0]); |
79 v8::V8::InitializeExternalStartupData(argv[0]); | 79 v8::V8::InitializeExternalStartupData(argv[0]); |
80 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); | 80 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); |
81 v8::V8::InitializePlatform(platform); | 81 v8::V8::InitializePlatform(platform); |
82 v8::V8::Initialize(); | 82 v8::V8::Initialize(); |
83 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); | 83 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); |
84 ShellArrayBufferAllocator array_buffer_allocator; | 84 ShellArrayBufferAllocator array_buffer_allocator; |
85 v8::Isolate::CreateParams create_params; | 85 v8::Isolate::CreateParams create_params; |
86 create_params.array_buffer_allocator = &array_buffer_allocator; | 86 create_params.array_buffer_allocator = &array_buffer_allocator; |
87 v8::Isolate* isolate = v8::Isolate::New(create_params); | 87 v8::Isolate* isolate = v8::Isolate::New(create_params); |
88 run_shell = (argc == 1); | 88 run_shell = (argc == 1); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 v8::Local<v8::Value> stack_trace_string; | 415 v8::Local<v8::Value> stack_trace_string; |
416 if (try_catch->StackTrace(context).ToLocal(&stack_trace_string) && | 416 if (try_catch->StackTrace(context).ToLocal(&stack_trace_string) && |
417 stack_trace_string->IsString() && | 417 stack_trace_string->IsString() && |
418 v8::Local<v8::String>::Cast(stack_trace_string)->Length() > 0) { | 418 v8::Local<v8::String>::Cast(stack_trace_string)->Length() > 0) { |
419 v8::String::Utf8Value stack_trace(stack_trace_string); | 419 v8::String::Utf8Value stack_trace(stack_trace_string); |
420 const char* stack_trace_string = ToCString(stack_trace); | 420 const char* stack_trace_string = ToCString(stack_trace); |
421 fprintf(stderr, "%s\n", stack_trace_string); | 421 fprintf(stderr, "%s\n", stack_trace_string); |
422 } | 422 } |
423 } | 423 } |
424 } | 424 } |
OLD | NEW |