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

Side by Side Diff: src/d8.cc

Issue 10704038: Fix isolate build. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 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/d8.h ('k') | no next file » | 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 CounterMap* Shell::counter_map_; 110 CounterMap* Shell::counter_map_;
111 i::OS::MemoryMappedFile* Shell::counters_file_ = NULL; 111 i::OS::MemoryMappedFile* Shell::counters_file_ = NULL;
112 CounterCollection Shell::local_counters_; 112 CounterCollection Shell::local_counters_;
113 CounterCollection* Shell::counters_ = &local_counters_; 113 CounterCollection* Shell::counters_ = &local_counters_;
114 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex()); 114 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex());
115 Persistent<Context> Shell::utility_context_; 115 Persistent<Context> Shell::utility_context_;
116 #endif // V8_SHARED 116 #endif // V8_SHARED
117 117
118 LineEditor* Shell::console = NULL; 118 LineEditor* Shell::console = NULL;
119 Persistent<Context> Shell::evaluation_context_; 119 Persistent<Context> Shell::evaluation_context_;
120 Persistent<FunctionTemplate> Shell::array_buffer_template_;
121 ShellOptions Shell::options; 120 ShellOptions Shell::options;
122 const char* Shell::kPrompt = "d8> "; 121 const char* Shell::kPrompt = "d8> ";
123 122
124 123
125 const int MB = 1024 * 1024; 124 const int MB = 1024 * 1024;
126 125
127 126
128 #ifndef V8_SHARED 127 #ifndef V8_SHARED
129 bool CounterMap::Match(void* key1, void* key2) { 128 bool CounterMap::Match(void* key1, void* key2) {
130 const char* name1 = reinterpret_cast<const char*>(key1); 129 const char* name1 = reinterpret_cast<const char*>(key1);
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 if (try_catch.HasCaught()) return try_catch.Exception(); 481 if (try_catch.HasCaught()) return try_catch.Exception();
483 init_from_array = true; 482 init_from_array = true;
484 } else { 483 } else {
485 // Construct from size. 484 // Construct from size.
486 length = convertToUint(args[0], &try_catch); 485 length = convertToUint(args[0], &try_catch);
487 if (try_catch.HasCaught()) return try_catch.Exception(); 486 if (try_catch.HasCaught()) return try_catch.Exception();
488 } 487 }
489 byteLength = length * element_size; 488 byteLength = length * element_size;
490 byteOffset = 0; 489 byteOffset = 0;
491 490
492 Handle<Value> array_buffer = array_buffer_template_->GetFunction(); 491 Handle<Object> global = Context::GetCurrent()->Global();
492 Handle<Value> array_buffer = global->Get(String::New("ArrayBuffer"));
rossberg 2012/06/29 09:12:40 I guess, since it's immutable, that is fine. Altho
493 ASSERT(!try_catch.HasCaught() && array_buffer->IsFunction()); 493 ASSERT(!try_catch.HasCaught() && array_buffer->IsFunction());
494 Handle<Value> buffer_args[] = { Uint32::New(byteLength) }; 494 Handle<Value> buffer_args[] = { Uint32::New(byteLength) };
495 Handle<Value> result = Handle<Function>::Cast(array_buffer)->NewInstance( 495 Handle<Value> result = Handle<Function>::Cast(array_buffer)->NewInstance(
496 1, buffer_args); 496 1, buffer_args);
497 if (try_catch.HasCaught()) return result; 497 if (try_catch.HasCaught()) return result;
498 buffer = result->ToObject(); 498 buffer = result->ToObject();
499 } 499 }
500 500
501 Handle<Object> array = CreateExternalArray( 501 Handle<Object> array = CreateExternalArray(
502 args.This(), buffer, type, length, byteLength, byteOffset, element_size); 502 args.This(), buffer, type, length, byteLength, byteOffset, element_size);
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 global_template->Set(String::New("quit"), FunctionTemplate::New(Quit)); 940 global_template->Set(String::New("quit"), FunctionTemplate::New(Quit));
941 global_template->Set(String::New("version"), FunctionTemplate::New(Version)); 941 global_template->Set(String::New("version"), FunctionTemplate::New(Version));
942 global_template->Set(String::New("enableProfiler"), 942 global_template->Set(String::New("enableProfiler"),
943 FunctionTemplate::New(EnableProfiler)); 943 FunctionTemplate::New(EnableProfiler));
944 global_template->Set(String::New("disableProfiler"), 944 global_template->Set(String::New("disableProfiler"),
945 FunctionTemplate::New(DisableProfiler)); 945 FunctionTemplate::New(DisableProfiler));
946 946
947 // Bind the handlers for external arrays. 947 // Bind the handlers for external arrays.
948 PropertyAttribute attr = 948 PropertyAttribute attr =
949 static_cast<PropertyAttribute>(ReadOnly | DontDelete); 949 static_cast<PropertyAttribute>(ReadOnly | DontDelete);
950 array_buffer_template_ =
951 Persistent<FunctionTemplate>::New(CreateArrayTemplate(ArrayBuffer));
952 global_template->Set(String::New("ArrayBuffer"), 950 global_template->Set(String::New("ArrayBuffer"),
953 array_buffer_template_, attr); 951 CreateArrayTemplate(ArrayBuffer), attr);
954 global_template->Set(String::New("Int8Array"), 952 global_template->Set(String::New("Int8Array"),
955 CreateArrayTemplate(Int8Array), attr); 953 CreateArrayTemplate(Int8Array), attr);
956 global_template->Set(String::New("Uint8Array"), 954 global_template->Set(String::New("Uint8Array"),
957 CreateArrayTemplate(Uint8Array), attr); 955 CreateArrayTemplate(Uint8Array), attr);
958 global_template->Set(String::New("Int16Array"), 956 global_template->Set(String::New("Int16Array"),
959 CreateArrayTemplate(Int16Array), attr); 957 CreateArrayTemplate(Int16Array), attr);
960 global_template->Set(String::New("Uint16Array"), 958 global_template->Set(String::New("Uint16Array"),
961 CreateArrayTemplate(Uint16Array), attr); 959 CreateArrayTemplate(Uint16Array), attr);
962 global_template->Set(String::New("Int32Array"), 960 global_template->Set(String::New("Int32Array"),
963 CreateArrayTemplate(Int32Array), attr); 961 CreateArrayTemplate(Int32Array), attr);
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 } 1677 }
1680 1678
1681 } // namespace v8 1679 } // namespace v8
1682 1680
1683 1681
1684 #ifndef GOOGLE3 1682 #ifndef GOOGLE3
1685 int main(int argc, char* argv[]) { 1683 int main(int argc, char* argv[]) {
1686 return v8::Shell::Main(argc, argv); 1684 return v8::Shell::Main(argc, argv);
1687 } 1685 }
1688 #endif 1686 #endif
OLDNEW
« no previous file with comments | « src/d8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698