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

Side by Side Diff: src/d8.cc

Issue 151603004: A64: Synchronize with r16587. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/cpu-profiler.cc ('k') | src/d8-debug.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 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 data_->realm_switch_ = 0; 264 data_->realm_switch_ = 0;
265 data_->realms_ = new Persistent<Context>[1]; 265 data_->realms_ = new Persistent<Context>[1];
266 data_->realms_[0].Reset(data_->isolate_, Context::GetEntered()); 266 data_->realms_[0].Reset(data_->isolate_, Context::GetEntered());
267 data_->realm_shared_.Clear(); 267 data_->realm_shared_.Clear();
268 } 268 }
269 269
270 270
271 PerIsolateData::RealmScope::~RealmScope() { 271 PerIsolateData::RealmScope::~RealmScope() {
272 // Drop realms to avoid keeping them alive. 272 // Drop realms to avoid keeping them alive.
273 for (int i = 0; i < data_->realm_count_; ++i) 273 for (int i = 0; i < data_->realm_count_; ++i)
274 data_->realms_[i].Dispose(data_->isolate_); 274 data_->realms_[i].Dispose();
275 delete[] data_->realms_; 275 delete[] data_->realms_;
276 if (!data_->realm_shared_.IsEmpty()) 276 if (!data_->realm_shared_.IsEmpty())
277 data_->realm_shared_.Dispose(data_->isolate_); 277 data_->realm_shared_.Dispose();
278 } 278 }
279 279
280 280
281 int PerIsolateData::RealmFind(Handle<Context> context) { 281 int PerIsolateData::RealmFind(Handle<Context> context) {
282 for (int i = 0; i < realm_count_; ++i) { 282 for (int i = 0; i < realm_count_; ++i) {
283 if (realms_[i] == context) return i; 283 if (realms_[i] == context) return i;
284 } 284 }
285 return -1; 285 return -1;
286 } 286 }
287 287
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 Throw("Invalid argument"); 354 Throw("Invalid argument");
355 return; 355 return;
356 } 356 }
357 int index = args[0]->Uint32Value(); 357 int index = args[0]->Uint32Value();
358 if (index >= data->realm_count_ || data->realms_[index].IsEmpty() || 358 if (index >= data->realm_count_ || data->realms_[index].IsEmpty() ||
359 index == 0 || 359 index == 0 ||
360 index == data->realm_current_ || index == data->realm_switch_) { 360 index == data->realm_current_ || index == data->realm_switch_) {
361 Throw("Invalid realm index"); 361 Throw("Invalid realm index");
362 return; 362 return;
363 } 363 }
364 data->realms_[index].Dispose(isolate); 364 data->realms_[index].Dispose();
365 data->realms_[index].Clear(); 365 data->realms_[index].Clear();
366 } 366 }
367 367
368 368
369 // Realm.switch(i) switches to the realm i for consecutive interactive inputs. 369 // Realm.switch(i) switches to the realm i for consecutive interactive inputs.
370 void Shell::RealmSwitch(const v8::FunctionCallbackInfo<v8::Value>& args) { 370 void Shell::RealmSwitch(const v8::FunctionCallbackInfo<v8::Value>& args) {
371 Isolate* isolate = args.GetIsolate(); 371 Isolate* isolate = args.GetIsolate();
372 PerIsolateData* data = PerIsolateData::Get(isolate); 372 PerIsolateData* data = PerIsolateData::Get(isolate);
373 if (args.Length() < 1 || !args[0]->IsNumber()) { 373 if (args.Length() < 1 || !args[0]->IsNumber()) {
374 Throw("Invalid argument"); 374 Throw("Invalid argument");
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 PerIsolateData* data = PerIsolateData::Get(isolate); 413 PerIsolateData* data = PerIsolateData::Get(isolate);
414 if (data->realm_shared_.IsEmpty()) return; 414 if (data->realm_shared_.IsEmpty()) return;
415 info.GetReturnValue().Set(data->realm_shared_); 415 info.GetReturnValue().Set(data->realm_shared_);
416 } 416 }
417 417
418 void Shell::RealmSharedSet(Local<String> property, 418 void Shell::RealmSharedSet(Local<String> property,
419 Local<Value> value, 419 Local<Value> value,
420 const PropertyCallbackInfo<void>& info) { 420 const PropertyCallbackInfo<void>& info) {
421 Isolate* isolate = info.GetIsolate(); 421 Isolate* isolate = info.GetIsolate();
422 PerIsolateData* data = PerIsolateData::Get(isolate); 422 PerIsolateData* data = PerIsolateData::Get(isolate);
423 if (!data->realm_shared_.IsEmpty()) data->realm_shared_.Dispose(isolate); 423 if (!data->realm_shared_.IsEmpty()) data->realm_shared_.Dispose();
424 data->realm_shared_.Reset(isolate, value); 424 data->realm_shared_.Reset(isolate, value);
425 } 425 }
426 426
427 427
428 void Shell::Print(const v8::FunctionCallbackInfo<v8::Value>& args) { 428 void Shell::Print(const v8::FunctionCallbackInfo<v8::Value>& args) {
429 Write(args); 429 Write(args);
430 printf("\n"); 430 printf("\n");
431 fflush(stdout); 431 fflush(stdout);
432 } 432 }
433 433
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 v8::Local<v8::Context>::New(isolate, utility_context_); 759 v8::Local<v8::Context>::New(isolate, utility_context_);
760 v8::Local<v8::Context> evaluation_context = 760 v8::Local<v8::Context> evaluation_context =
761 v8::Local<v8::Context>::New(isolate, evaluation_context_); 761 v8::Local<v8::Context>::New(isolate, evaluation_context_);
762 utility_context->SetSecurityToken(Undefined(isolate)); 762 utility_context->SetSecurityToken(Undefined(isolate));
763 evaluation_context->SetSecurityToken(Undefined(isolate)); 763 evaluation_context->SetSecurityToken(Undefined(isolate));
764 v8::Context::Scope context_scope(utility_context); 764 v8::Context::Scope context_scope(utility_context);
765 765
766 #ifdef ENABLE_DEBUGGER_SUPPORT 766 #ifdef ENABLE_DEBUGGER_SUPPORT
767 if (i::FLAG_debugger) printf("JavaScript debugger enabled\n"); 767 if (i::FLAG_debugger) printf("JavaScript debugger enabled\n");
768 // Install the debugger object in the utility scope 768 // Install the debugger object in the utility scope
769 i::Debug* debug = i::Isolate::Current()->debug(); 769 i::Debug* debug = reinterpret_cast<i::Isolate*>(isolate)->debug();
770 debug->Load(); 770 debug->Load();
771 i::Handle<i::JSObject> js_debug 771 i::Handle<i::JSObject> js_debug
772 = i::Handle<i::JSObject>(debug->debug_context()->global_object()); 772 = i::Handle<i::JSObject>(debug->debug_context()->global_object());
773 utility_context->Global()->Set(String::New("$debug"), 773 utility_context->Global()->Set(String::New("$debug"),
774 Utils::ToLocal(js_debug)); 774 Utils::ToLocal(js_debug));
775 debug->debug_context()->set_security_token(HEAP->undefined_value()); 775 debug->debug_context()->set_security_token(HEAP->undefined_value());
776 #endif // ENABLE_DEBUGGER_SUPPORT 776 #endif // ENABLE_DEBUGGER_SUPPORT
777 777
778 // Run the d8 shell utility script in the utility context 778 // Run the d8 shell utility script in the utility context
779 int source_index = i::NativesCollection<i::D8>::GetIndex("d8"); 779 int source_index = i::NativesCollection<i::D8>::GetIndex("d8");
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 i::LockGuard<i::Mutex> lock_guard(&context_mutex_); 928 i::LockGuard<i::Mutex> lock_guard(&context_mutex_);
929 #endif // V8_SHARED 929 #endif // V8_SHARED
930 // Initialize the global objects 930 // Initialize the global objects
931 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); 931 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
932 HandleScope handle_scope(isolate); 932 HandleScope handle_scope(isolate);
933 Local<Context> context = Context::New(isolate, NULL, global_template); 933 Local<Context> context = Context::New(isolate, NULL, global_template);
934 ASSERT(!context.IsEmpty()); 934 ASSERT(!context.IsEmpty());
935 Context::Scope scope(context); 935 Context::Scope scope(context);
936 936
937 #ifndef V8_SHARED 937 #ifndef V8_SHARED
938 i::Factory* factory = i::Isolate::Current()->factory(); 938 i::Factory* factory = reinterpret_cast<i::Isolate*>(isolate)->factory();
939 i::JSArguments js_args = i::FLAG_js_arguments; 939 i::JSArguments js_args = i::FLAG_js_arguments;
940 i::Handle<i::FixedArray> arguments_array = 940 i::Handle<i::FixedArray> arguments_array =
941 factory->NewFixedArray(js_args.argc()); 941 factory->NewFixedArray(js_args.argc());
942 for (int j = 0; j < js_args.argc(); j++) { 942 for (int j = 0; j < js_args.argc(); j++) {
943 i::Handle<i::String> arg = 943 i::Handle<i::String> arg =
944 factory->NewStringFromUtf8(i::CStrVector(js_args[j])); 944 factory->NewStringFromUtf8(i::CStrVector(js_args[j]));
945 arguments_array->set(j, *arg); 945 arguments_array->set(j, *arg);
946 } 946 }
947 i::Handle<i::JSArray> arguments_jsarray = 947 i::Handle<i::JSArray> arguments_jsarray =
948 factory->NewJSArrayWithElements(arguments_array); 948 factory->NewJSArrayWithElements(arguments_array);
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 } 1724 }
1725 1725
1726 } // namespace v8 1726 } // namespace v8
1727 1727
1728 1728
1729 #ifndef GOOGLE3 1729 #ifndef GOOGLE3
1730 int main(int argc, char* argv[]) { 1730 int main(int argc, char* argv[]) {
1731 return v8::Shell::Main(argc, argv); 1731 return v8::Shell::Main(argc, argv);
1732 } 1732 }
1733 #endif 1733 #endif
OLDNEW
« no previous file with comments | « src/cpu-profiler.cc ('k') | src/d8-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698