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

Unified Diff: src/d8.cc

Issue 14021004: Revert r14310 due to isolate tests failure. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/d8.h ('k') | src/debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index e52e9a50a42ef2ca4dab421122722f7f4e35bfd2..8f6e384c1a5fee8919de1052060597e056bb5a25 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -83,7 +83,7 @@ const char kArrayBufferMarkerPropName[] = "d8::_is_array_buffer_";
const char kArrayMarkerPropName[] = "d8::_is_typed_array_";
-#define FOR_EACH_STRING(V) \
+#define FOR_EACH_SYMBOL(V) \
V(ArrayBuffer, "ArrayBuffer") \
V(ArrayBufferMarkerPropName, kArrayBufferMarkerPropName) \
V(ArrayMarkerPropName, kArrayMarkerPropName) \
@@ -94,50 +94,36 @@ const char kArrayMarkerPropName[] = "d8::_is_typed_array_";
V(length, "length")
-class PerIsolateData {
+class Symbols {
public:
- explicit PerIsolateData(Isolate* isolate) : isolate_(isolate), realms_(NULL) {
+ explicit Symbols(Isolate* isolate) : isolate_(isolate) {
HandleScope scope(isolate);
-#define INIT_STRING(name, value) \
- name##_string_ = Persistent<String>::New(isolate, String::NewSymbol(value));
- FOR_EACH_STRING(INIT_STRING)
-#undef INIT_STRING
+#define INIT_SYMBOL(name, value) \
+ name##_ = Persistent<String>::New(isolate, String::NewSymbol(value));
+ FOR_EACH_SYMBOL(INIT_SYMBOL)
+#undef INIT_SYMBOL
isolate->SetData(this);
}
- ~PerIsolateData() {
-#define DISPOSE_STRING(name, value) name##_string_.Dispose(isolate_);
- FOR_EACH_STRING(DISPOSE_STRING)
-#undef DISPOSE_STRING
+ ~Symbols() {
+#define DISPOSE_SYMBOL(name, value) name##_.Dispose(isolate_);
+ FOR_EACH_SYMBOL(DISPOSE_SYMBOL)
+#undef DISPOSE_SYMBOL
isolate_->SetData(NULL); // Not really needed, just to be sure...
}
- inline static PerIsolateData* Get(Isolate* isolate) {
- return reinterpret_cast<PerIsolateData*>(isolate->GetData());
+#define DEFINE_SYMBOL_GETTER(name, value) \
+ static Persistent<String> name(Isolate* isolate) { \
+ return reinterpret_cast<Symbols*>(isolate->GetData())->name##_; \
}
-
-#define DEFINE_STRING_GETTER(name, value) \
- static Persistent<String> name##_string(Isolate* isolate) { \
- return Get(isolate)->name##_string_; \
- }
- FOR_EACH_STRING(DEFINE_STRING_GETTER)
-#undef DEFINE_STRING_GETTER
+ FOR_EACH_SYMBOL(DEFINE_SYMBOL_GETTER)
+#undef DEFINE_SYMBOL_GETTER
private:
- friend class Shell;
Isolate* isolate_;
- int realm_count_;
- int realm_current_;
- int realm_switch_;
- Persistent<Context>* realms_;
- Persistent<Value> realm_shared_;
-
-#define DEFINE_MEMBER(name, value) Persistent<String> name##_string_;
- FOR_EACH_STRING(DEFINE_MEMBER)
+#define DEFINE_MEMBER(name, value) Persistent<String> name##_;
+ FOR_EACH_SYMBOL(DEFINE_MEMBER)
#undef DEFINE_MEMBER
-
- void RealmInit();
- int RealmFind(Handle<Context> context);
};
@@ -221,20 +207,14 @@ bool Shell::ExecuteString(Isolate* isolate,
// When debugging make exceptions appear to be uncaught.
try_catch.SetVerbose(true);
}
- Handle<Script> script = Script::New(source, name);
+ Handle<Script> script = Script::Compile(source, name);
if (script.IsEmpty()) {
// Print errors that happened during compilation.
if (report_exceptions && !FLAG_debugger)
ReportException(isolate, &try_catch);
return false;
} else {
- PerIsolateData* data = PerIsolateData::Get(isolate);
- Local<Context> realm =
- Local<Context>::New(data->realms_[data->realm_current_]);
- realm->Enter();
Handle<Value> result = script->Run();
- realm->Exit();
- data->realm_current_ = data->realm_switch_;
if (result.IsEmpty()) {
ASSERT(try_catch.HasCaught());
// Print errors that happened during execution.
@@ -275,159 +255,6 @@ bool Shell::ExecuteString(Isolate* isolate,
}
-void PerIsolateData::RealmInit() {
- if (realms_ != NULL) {
- // Drop realms from previous run.
- for (int i = 0; i < realm_count_; ++i) realms_[i].Dispose(isolate_);
- delete[] realms_;
- if (!realm_shared_.IsEmpty()) realm_shared_.Dispose(isolate_);
- }
- realm_count_ = 1;
- realm_current_ = 0;
- realm_switch_ = 0;
- realms_ = new Persistent<Context>[1];
- realms_[0] = Persistent<Context>::New(isolate_, Context::GetEntered());
- realm_shared_.Clear();
-}
-
-
-int PerIsolateData::RealmFind(Handle<Context> context) {
- for (int i = 0; i < realm_count_; ++i) {
- if (realms_[i] == context) return i;
- }
- return -1;
-}
-
-
-// Realm.current() returns the index of the currently active realm.
-Handle<Value> Shell::RealmCurrent(const Arguments& args) {
- Isolate* isolate = args.GetIsolate();
- PerIsolateData* data = PerIsolateData::Get(isolate);
- int index = data->RealmFind(Context::GetEntered());
- if (index == -1) return Undefined(isolate);
- return Number::New(index);
-}
-
-
-// Realm.owner(o) returns the index of the realm that created o.
-Handle<Value> Shell::RealmOwner(const Arguments& args) {
- Isolate* isolate = args.GetIsolate();
- PerIsolateData* data = PerIsolateData::Get(isolate);
- if (args.Length() < 1 || !args[0]->IsObject()) {
- return Throw("Invalid argument");
- }
- int index = data->RealmFind(args[0]->ToObject()->CreationContext());
- if (index == -1) return Undefined(isolate);
- return Number::New(index);
-}
-
-
-// Realm.global(i) returns the global object of realm i.
-// (Note that properties of global objects cannot be read/written cross-realm.)
-Handle<Value> Shell::RealmGlobal(const Arguments& args) {
- PerIsolateData* data = PerIsolateData::Get(args.GetIsolate());
- if (args.Length() < 1 || !args[0]->IsNumber()) {
- return Throw("Invalid argument");
- }
- int index = args[0]->Uint32Value();
- if (index >= data->realm_count_ || data->realms_[index].IsEmpty()) {
- return Throw("Invalid realm index");
- }
- return data->realms_[index]->Global();
-}
-
-
-// Realm.create() creates a new realm and returns its index.
-Handle<Value> Shell::RealmCreate(const Arguments& args) {
- Isolate* isolate = args.GetIsolate();
- PerIsolateData* data = PerIsolateData::Get(isolate);
- Persistent<Context>* old_realms = data->realms_;
- int index = data->realm_count_;
- data->realms_ = new Persistent<Context>[++data->realm_count_];
- for (int i = 0; i < index; ++i) data->realms_[i] = old_realms[i];
- delete[] old_realms;
- Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
- data->realms_[index] = Persistent<Context>::New(
- isolate, Context::New(isolate, NULL, global_template));
- return Number::New(index);
-}
-
-
-// Realm.dispose(i) disposes the reference to the realm i.
-Handle<Value> Shell::RealmDispose(const Arguments& args) {
- Isolate* isolate = args.GetIsolate();
- PerIsolateData* data = PerIsolateData::Get(isolate);
- if (args.Length() < 1 || !args[0]->IsNumber()) {
- return Throw("Invalid argument");
- }
- int index = args[0]->Uint32Value();
- if (index >= data->realm_count_ || data->realms_[index].IsEmpty() ||
- index == 0 ||
- index == data->realm_current_ || index == data->realm_switch_) {
- return Throw("Invalid realm index");
- }
- data->realms_[index].Dispose(isolate);
- data->realms_[index].Clear();
- return Undefined(isolate);
-}
-
-
-// Realm.switch(i) switches to the realm i for consecutive interactive inputs.
-Handle<Value> Shell::RealmSwitch(const Arguments& args) {
- Isolate* isolate = args.GetIsolate();
- PerIsolateData* data = PerIsolateData::Get(isolate);
- if (args.Length() < 1 || !args[0]->IsNumber()) {
- return Throw("Invalid argument");
- }
- int index = args[0]->Uint32Value();
- if (index >= data->realm_count_ || data->realms_[index].IsEmpty()) {
- return Throw("Invalid realm index");
- }
- data->realm_switch_ = index;
- return Undefined(isolate);
-}
-
-
-// Realm.eval(i, s) evaluates s in realm i and returns the result.
-Handle<Value> Shell::RealmEval(const Arguments& args) {
- Isolate* isolate = args.GetIsolate();
- PerIsolateData* data = PerIsolateData::Get(isolate);
- if (args.Length() < 2 || !args[0]->IsNumber() || !args[1]->IsString()) {
- return Throw("Invalid argument");
- }
- int index = args[0]->Uint32Value();
- if (index >= data->realm_count_ || data->realms_[index].IsEmpty()) {
- return Throw("Invalid realm index");
- }
- Handle<Script> script = Script::New(args[1]->ToString());
- if (script.IsEmpty()) return Undefined(isolate);
- Local<Context> realm = Local<Context>::New(data->realms_[index]);
- realm->Enter();
- Handle<Value> result = script->Run();
- realm->Exit();
- return result;
-}
-
-
-// Realm.shared is an accessor for a single shared value across realms.
-Handle<Value> Shell::RealmSharedGet(Local<String> property,
- const AccessorInfo& info) {
- Isolate* isolate = info.GetIsolate();
- PerIsolateData* data = PerIsolateData::Get(isolate);
- if (data->realm_shared_.IsEmpty()) return Undefined(isolate);
- return data->realm_shared_;
-}
-
-void Shell::RealmSharedSet(Local<String> property,
- Local<Value> value,
- const AccessorInfo& info) {
- Isolate* isolate = info.GetIsolate();
- PerIsolateData* data = PerIsolateData::Get(isolate);
- if (!data->realm_shared_.IsEmpty()) data->realm_shared_.Dispose(isolate);
- data->realm_shared_ = Persistent<Value>::New(isolate, value);
-}
-
-
Handle<Value> Shell::Print(const Arguments& args) {
Handle<Value> val = Write(args);
printf("\n");
@@ -589,8 +416,7 @@ Handle<Value> Shell::CreateExternalArrayBuffer(Isolate* isolate,
}
memset(data, 0, length);
- buffer->SetHiddenValue(
- PerIsolateData::ArrayBufferMarkerPropName_string(isolate), True());
+ buffer->SetHiddenValue(Symbols::ArrayBufferMarkerPropName(isolate), True());
Persistent<Object> persistent_array =
Persistent<Object>::New(isolate, buffer);
persistent_array.MakeWeak(isolate, data, ExternalArrayWeakCallback);
@@ -599,7 +425,7 @@ Handle<Value> Shell::CreateExternalArrayBuffer(Isolate* isolate,
buffer->SetIndexedPropertiesToExternalArrayData(
data, v8::kExternalByteArray, length);
- buffer->Set(PerIsolateData::byteLength_string(isolate),
+ buffer->Set(Symbols::byteLength(isolate),
Int32::New(length, isolate),
ReadOnly);
@@ -644,20 +470,20 @@ Handle<Object> Shell::CreateExternalArray(Isolate* isolate,
array->SetIndexedPropertiesToExternalArrayData(
static_cast<uint8_t*>(data) + byteOffset, type, length);
- array->SetHiddenValue(PerIsolateData::ArrayMarkerPropName_string(isolate),
+ array->SetHiddenValue(Symbols::ArrayMarkerPropName(isolate),
Int32::New(type, isolate));
- array->Set(PerIsolateData::byteLength_string(isolate),
+ array->Set(Symbols::byteLength(isolate),
Int32::New(byteLength, isolate),
ReadOnly);
- array->Set(PerIsolateData::byteOffset_string(isolate),
+ array->Set(Symbols::byteOffset(isolate),
Int32::New(byteOffset, isolate),
ReadOnly);
- array->Set(PerIsolateData::length_string(isolate),
+ array->Set(Symbols::length(isolate),
Int32::New(length, isolate),
ReadOnly);
- array->Set(PerIsolateData::BYTES_PER_ELEMENT_string(isolate),
+ array->Set(Symbols::BYTES_PER_ELEMENT(isolate),
Int32::New(element_size, isolate));
- array->Set(PerIsolateData::buffer_string(isolate),
+ array->Set(Symbols::buffer(isolate),
buffer,
ReadOnly);
@@ -698,11 +524,11 @@ Handle<Value> Shell::CreateExternalArray(const Arguments& args,
}
if (args[0]->IsObject() &&
!args[0]->ToObject()->GetHiddenValue(
- PerIsolateData::ArrayBufferMarkerPropName_string(isolate)).IsEmpty()) {
+ Symbols::ArrayBufferMarkerPropName(isolate)).IsEmpty()) {
// Construct from ArrayBuffer.
buffer = args[0]->ToObject();
- int32_t bufferLength = convertToUint(
- buffer->Get(PerIsolateData::byteLength_string(isolate)), &try_catch);
+ int32_t bufferLength =
+ convertToUint(buffer->Get(Symbols::byteLength(isolate)), &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
if (args.Length() < 2 || args[1]->IsUndefined()) {
@@ -734,10 +560,9 @@ Handle<Value> Shell::CreateExternalArray(const Arguments& args,
}
} else {
if (args[0]->IsObject() &&
- args[0]->ToObject()->Has(PerIsolateData::length_string(isolate))) {
+ args[0]->ToObject()->Has(Symbols::length(isolate))) {
// Construct from array.
- Local<Value> value =
- args[0]->ToObject()->Get(PerIsolateData::length_string(isolate));
+ Local<Value> value = args[0]->ToObject()->Get(Symbols::length(isolate));
if (try_catch.HasCaught()) return try_catch.ReThrow();
length = convertToUint(value, &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
@@ -751,8 +576,7 @@ Handle<Value> Shell::CreateExternalArray(const Arguments& args,
byteOffset = 0;
Handle<Object> global = Context::GetCurrent()->Global();
- Handle<Value> array_buffer =
- global->Get(PerIsolateData::ArrayBuffer_string(isolate));
+ Handle<Value> array_buffer = global->Get(Symbols::ArrayBuffer(isolate));
ASSERT(!try_catch.HasCaught() && array_buffer->IsFunction());
Handle<Value> buffer_args[] = { Uint32::New(byteLength, isolate) };
Handle<Value> result = Handle<Function>::Cast(array_buffer)->NewInstance(
@@ -787,14 +611,14 @@ Handle<Value> Shell::ArrayBufferSlice(const Arguments& args) {
Isolate* isolate = args.GetIsolate();
Local<Object> self = args.This();
- Local<Value> marker = self->GetHiddenValue(
- PerIsolateData::ArrayBufferMarkerPropName_string(isolate));
+ Local<Value> marker =
+ self->GetHiddenValue(Symbols::ArrayBufferMarkerPropName(isolate));
if (marker.IsEmpty()) {
return Throw("'slice' invoked on wrong receiver type");
}
- int32_t length = convertToUint(
- self->Get(PerIsolateData::byteLength_string(isolate)), &try_catch);
+ int32_t length =
+ convertToUint(self->Get(Symbols::byteLength(isolate)), &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
if (args.Length() == 0) {
@@ -843,22 +667,21 @@ Handle<Value> Shell::ArraySubArray(const Arguments& args) {
Isolate* isolate = args.GetIsolate();
Local<Object> self = args.This();
Local<Value> marker =
- self->GetHiddenValue(PerIsolateData::ArrayMarkerPropName_string(isolate));
+ self->GetHiddenValue(Symbols::ArrayMarkerPropName(isolate));
if (marker.IsEmpty()) {
return Throw("'subarray' invoked on wrong receiver type");
}
- Handle<Object> buffer =
- self->Get(PerIsolateData::buffer_string(isolate))->ToObject();
+ Handle<Object> buffer = self->Get(Symbols::buffer(isolate))->ToObject();
if (try_catch.HasCaught()) return try_catch.ReThrow();
- int32_t length = convertToUint(
- self->Get(PerIsolateData::length_string(isolate)), &try_catch);
+ int32_t length =
+ convertToUint(self->Get(Symbols::length(isolate)), &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
- int32_t byteOffset = convertToUint(
- self->Get(PerIsolateData::byteOffset_string(isolate)), &try_catch);
+ int32_t byteOffset =
+ convertToUint(self->Get(Symbols::byteOffset(isolate)), &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
- int32_t element_size = convertToUint(
- self->Get(PerIsolateData::BYTES_PER_ELEMENT_string(isolate)), &try_catch);
+ int32_t element_size =
+ convertToUint(self->Get(Symbols::BYTES_PER_ELEMENT(isolate)), &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
if (args.Length() == 0) {
@@ -903,27 +726,27 @@ Handle<Value> Shell::ArraySet(const Arguments& args) {
Isolate* isolate = args.GetIsolate();
Local<Object> self = args.This();
Local<Value> marker =
- self->GetHiddenValue(PerIsolateData::ArrayMarkerPropName_string(isolate));
+ self->GetHiddenValue(Symbols::ArrayMarkerPropName(isolate));
if (marker.IsEmpty()) {
return Throw("'set' invoked on wrong receiver type");
}
- int32_t length = convertToUint(
- self->Get(PerIsolateData::length_string(isolate)), &try_catch);
+ int32_t length =
+ convertToUint(self->Get(Symbols::length(isolate)), &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
- int32_t element_size = convertToUint(
- self->Get(PerIsolateData::BYTES_PER_ELEMENT_string(isolate)), &try_catch);
+ int32_t element_size =
+ convertToUint(self->Get(Symbols::BYTES_PER_ELEMENT(isolate)), &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
if (args.Length() == 0) {
return Throw("'set' must have at least one argument");
}
if (!args[0]->IsObject() ||
- !args[0]->ToObject()->Has(PerIsolateData::length_string(isolate))) {
+ !args[0]->ToObject()->Has(Symbols::length(isolate))) {
return Throw("'set' invoked with non-array argument");
}
Handle<Object> source = args[0]->ToObject();
- int32_t source_length = convertToUint(
- source->Get(PerIsolateData::length_string(isolate)), &try_catch);
+ int32_t source_length =
+ convertToUint(source->Get(Symbols::length(isolate)), &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
int32_t offset;
@@ -938,30 +761,28 @@ Handle<Value> Shell::ArraySet(const Arguments& args) {
}
int32_t source_element_size;
- if (source->GetHiddenValue(
- PerIsolateData::ArrayMarkerPropName_string(isolate)).IsEmpty()) {
+ if (source->GetHiddenValue(Symbols::ArrayMarkerPropName(isolate)).IsEmpty()) {
source_element_size = 0;
} else {
- source_element_size = convertToUint(
- source->Get(PerIsolateData::BYTES_PER_ELEMENT_string(isolate)),
- &try_catch);
+ source_element_size =
+ convertToUint(source->Get(Symbols::BYTES_PER_ELEMENT(isolate)),
+ &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
}
if (element_size == source_element_size &&
self->GetConstructor()->StrictEquals(source->GetConstructor())) {
// Use memmove on the array buffers.
- Handle<Object> buffer =
- self->Get(PerIsolateData::buffer_string(isolate))->ToObject();
+ Handle<Object> buffer = self->Get(Symbols::buffer(isolate))->ToObject();
if (try_catch.HasCaught()) return try_catch.ReThrow();
Handle<Object> source_buffer =
- source->Get(PerIsolateData::buffer_string(isolate))->ToObject();
+ source->Get(Symbols::buffer(isolate))->ToObject();
if (try_catch.HasCaught()) return try_catch.ReThrow();
- int32_t byteOffset = convertToUint(
- self->Get(PerIsolateData::byteOffset_string(isolate)), &try_catch);
+ int32_t byteOffset =
+ convertToUint(self->Get(Symbols::byteOffset(isolate)), &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
- int32_t source_byteOffset = convertToUint(
- source->Get(PerIsolateData::byteOffset_string(isolate)), &try_catch);
+ int32_t source_byteOffset =
+ convertToUint(source->Get(Symbols::byteOffset(isolate)), &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
uint8_t* dest = byteOffset + offset * element_size + static_cast<uint8_t*>(
@@ -977,22 +798,21 @@ Handle<Value> Shell::ArraySet(const Arguments& args) {
}
} else {
// Need to copy element-wise to make the right conversions.
- Handle<Object> buffer =
- self->Get(PerIsolateData::buffer_string(isolate))->ToObject();
+ Handle<Object> buffer = self->Get(Symbols::buffer(isolate))->ToObject();
if (try_catch.HasCaught()) return try_catch.ReThrow();
Handle<Object> source_buffer =
- source->Get(PerIsolateData::buffer_string(isolate))->ToObject();
+ source->Get(Symbols::buffer(isolate))->ToObject();
if (try_catch.HasCaught()) return try_catch.ReThrow();
if (buffer->StrictEquals(source_buffer)) {
// Same backing store, need to handle overlap correctly.
// This gets a bit tricky in the case of different element sizes
// (which, of course, is extremely unlikely to ever occur in practice).
- int32_t byteOffset = convertToUint(
- self->Get(PerIsolateData::byteOffset_string(isolate)), &try_catch);
+ int32_t byteOffset =
+ convertToUint(self->Get(Symbols::byteOffset(isolate)), &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
- int32_t source_byteOffset = convertToUint(
- source->Get(PerIsolateData::byteOffset_string(isolate)), &try_catch);
+ int32_t source_byteOffset =
+ convertToUint(source->Get(Symbols::byteOffset(isolate)), &try_catch);
if (try_catch.HasCaught()) return try_catch.ReThrow();
// Copy as much as we can from left to right.
@@ -1040,8 +860,8 @@ void Shell::ExternalArrayWeakCallback(v8::Isolate* isolate,
Persistent<Value> object,
void* data) {
HandleScope scope(isolate);
- int32_t length = object->ToObject()->Get(
- PerIsolateData::byteLength_string(isolate))->Uint32Value();
+ int32_t length =
+ object->ToObject()->Get(Symbols::byteLength(isolate))->Uint32Value();
isolate->AdjustAmountOfExternalAllocatedMemory(-length);
delete[] static_cast<uint8_t*>(data);
object.Dispose(isolate);
@@ -1418,30 +1238,10 @@ Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
global_template->Set(String::New("disableProfiler"),
FunctionTemplate::New(DisableProfiler));
- // Bind the Realm object.
- Handle<ObjectTemplate> realm_template = ObjectTemplate::New();
- realm_template->Set(String::New("current"),
- FunctionTemplate::New(RealmCurrent));
- realm_template->Set(String::New("owner"),
- FunctionTemplate::New(RealmOwner));
- realm_template->Set(String::New("global"),
- FunctionTemplate::New(RealmGlobal));
- realm_template->Set(String::New("create"),
- FunctionTemplate::New(RealmCreate));
- realm_template->Set(String::New("dispose"),
- FunctionTemplate::New(RealmDispose));
- realm_template->Set(String::New("switch"),
- FunctionTemplate::New(RealmSwitch));
- realm_template->Set(String::New("eval"),
- FunctionTemplate::New(RealmEval));
- realm_template->SetAccessor(String::New("shared"),
- RealmSharedGet, RealmSharedSet);
- global_template->Set(String::New("Realm"), realm_template);
-
// Bind the handlers for external arrays.
PropertyAttribute attr =
static_cast<PropertyAttribute>(ReadOnly | DontDelete);
- global_template->Set(PerIsolateData::ArrayBuffer_string(isolate),
+ global_template->Set(Symbols::ArrayBuffer(isolate),
CreateArrayBufferTemplate(ArrayBuffer), attr);
global_template->Set(String::New("Int8Array"),
CreateArrayTemplate(Int8Array), attr);
@@ -1525,7 +1325,6 @@ Persistent<Context> Shell::CreateEvaluationContext(Isolate* isolate) {
Persistent<Context> context = Context::New(NULL, global_template);
ASSERT(!context.IsEmpty());
Context::Scope scope(context);
- PerIsolateData::Get(isolate)->RealmInit();
#ifndef V8_SHARED
i::JSArguments js_args = i::FLAG_js_arguments;
@@ -1670,8 +1469,7 @@ Handle<Value> Shell::ReadBuffer(const Arguments& args) {
}
Isolate* isolate = args.GetIsolate();
Handle<Object> buffer = Object::New();
- buffer->SetHiddenValue(
- PerIsolateData::ArrayBufferMarkerPropName_string(isolate), True());
+ buffer->SetHiddenValue(Symbols::ArrayBufferMarkerPropName(isolate), True());
Persistent<Object> persistent_buffer =
Persistent<Object>::New(isolate, buffer);
persistent_buffer.MakeWeak(isolate, data, ExternalArrayWeakCallback);
@@ -1680,7 +1478,7 @@ Handle<Value> Shell::ReadBuffer(const Arguments& args) {
buffer->SetIndexedPropertiesToExternalArrayData(
data, kExternalUnsignedByteArray, length);
- buffer->Set(PerIsolateData::byteLength_string(isolate),
+ buffer->Set(Symbols::byteLength(isolate),
Int32::New(static_cast<int32_t>(length), isolate), ReadOnly);
return buffer;
}
@@ -1873,7 +1671,7 @@ void SourceGroup::ExecuteInThread() {
Isolate::Scope iscope(isolate);
Locker lock(isolate);
HandleScope scope(isolate);
- PerIsolateData data(isolate);
+ Symbols symbols(isolate);
Persistent<Context> context = Shell::CreateEvaluationContext(isolate);
{
Context::Scope cscope(context);
@@ -2135,7 +1933,7 @@ int Shell::Main(int argc, char* argv[]) {
#ifdef ENABLE_VTUNE_JIT_INTERFACE
vTune::InitilizeVtuneForV8();
#endif
- PerIsolateData data(isolate);
+ Symbols symbols(isolate);
InitializeDebugger(isolate);
if (options.stress_opt || options.stress_deopt) {
« no previous file with comments | « src/d8.h ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698