| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 // Defined when linking against shared lib on Windows. | 6 // Defined when linking against shared lib on Windows. |
| 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) | 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) |
| 8 #define V8_SHARED | 8 #define V8_SHARED |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 | 473 |
| 474 // Realm.create() creates a new realm and returns its index. | 474 // Realm.create() creates a new realm and returns its index. |
| 475 void Shell::RealmCreate(const v8::FunctionCallbackInfo<v8::Value>& args) { | 475 void Shell::RealmCreate(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 476 Isolate* isolate = args.GetIsolate(); | 476 Isolate* isolate = args.GetIsolate(); |
| 477 PerIsolateData* data = PerIsolateData::Get(isolate); | 477 PerIsolateData* data = PerIsolateData::Get(isolate); |
| 478 Persistent<Context>* old_realms = data->realms_; | 478 Persistent<Context>* old_realms = data->realms_; |
| 479 int index = data->realm_count_; | 479 int index = data->realm_count_; |
| 480 data->realms_ = new Persistent<Context>[++data->realm_count_]; | 480 data->realms_ = new Persistent<Context>[++data->realm_count_]; |
| 481 for (int i = 0; i < index; ++i) { | 481 for (int i = 0; i < index; ++i) { |
| 482 data->realms_[i].Reset(isolate, old_realms[i]); | 482 data->realms_[i].Reset(isolate, old_realms[i]); |
| 483 old_realms[i].Reset(); |
| 483 } | 484 } |
| 484 delete[] old_realms; | 485 delete[] old_realms; |
| 485 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); | 486 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); |
| 486 data->realms_[index].Reset( | 487 data->realms_[index].Reset( |
| 487 isolate, Context::New(isolate, NULL, global_template)); | 488 isolate, Context::New(isolate, NULL, global_template)); |
| 488 args.GetReturnValue().Set(index); | 489 args.GetReturnValue().Set(index); |
| 489 } | 490 } |
| 490 | 491 |
| 491 | 492 |
| 492 // Realm.dispose(i) disposes the reference to the realm i. | 493 // Realm.dispose(i) disposes the reference to the realm i. |
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 } | 1756 } |
| 1756 | 1757 |
| 1757 } // namespace v8 | 1758 } // namespace v8 |
| 1758 | 1759 |
| 1759 | 1760 |
| 1760 #ifndef GOOGLE3 | 1761 #ifndef GOOGLE3 |
| 1761 int main(int argc, char* argv[]) { | 1762 int main(int argc, char* argv[]) { |
| 1762 return v8::Shell::Main(argc, argv); | 1763 return v8::Shell::Main(argc, argv); |
| 1763 } | 1764 } |
| 1764 #endif | 1765 #endif |
| OLD | NEW |