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

Unified Diff: src/api.cc

Issue 2028983002: Introduce IsUndefined(Isolate*) and IsTheHole(Isolate*) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase master Created 4 years, 6 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/accessors.cc ('k') | src/api-arguments.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index d6336f2846be74c571a5b694d35529236c76af7c..7d3e860ddbe4be45bff28e936e14c8dbbbed7c96 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -812,9 +812,8 @@ EscapableHandleScope::EscapableHandleScope(Isolate* v8_isolate) {
i::Object** EscapableHandleScope::Escape(i::Object** escape_value) {
i::Heap* heap = reinterpret_cast<i::Isolate*>(GetIsolate())->heap();
- Utils::ApiCheck(*escape_slot_ == heap->the_hole_value(),
- "EscapeableHandleScope::Escape",
- "Escape value set twice");
+ Utils::ApiCheck((*escape_slot_)->IsTheHole(heap->isolate()),
+ "EscapeableHandleScope::Escape", "Escape value set twice");
if (escape_value == NULL) {
*escape_slot_ = heap->undefined_value();
return NULL;
@@ -1075,7 +1074,7 @@ Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
ENTER_V8(i_isolate);
i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template(),
i_isolate);
- if (result->IsUndefined()) {
+ if (result->IsUndefined(i_isolate)) {
// Do not cache prototype objects.
result = Utils::OpenHandle(
*ObjectTemplateNew(i_isolate, Local<FunctionTemplate>(), true));
@@ -1255,7 +1254,7 @@ Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() {
}
i::Isolate* isolate = handle->GetIsolate();
ENTER_V8(isolate);
- if (handle->instance_template()->IsUndefined()) {
+ if (handle->instance_template()->IsUndefined(isolate)) {
Local<ObjectTemplate> templ =
ObjectTemplate::New(isolate, ToApiHandle<FunctionTemplate>(handle));
handle->set_instance_template(*Utils::OpenHandle(*templ));
@@ -1369,7 +1368,7 @@ static i::Handle<i::FunctionTemplateInfo> EnsureConstructor(
i::Isolate* isolate,
ObjectTemplate* object_template) {
i::Object* obj = Utils::OpenHandle(object_template)->constructor();
- if (!obj ->IsUndefined()) {
+ if (!obj->IsUndefined(isolate)) {
i::FunctionTemplateInfo* info = i::FunctionTemplateInfo::cast(obj);
return i::Handle<i::FunctionTemplateInfo>(info, isolate);
}
@@ -2258,7 +2257,7 @@ v8::TryCatch::~TryCatch() {
bool v8::TryCatch::HasCaught() const {
- return !reinterpret_cast<i::Object*>(exception_)->IsTheHole();
+ return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(isolate_);
}
@@ -2317,8 +2316,8 @@ v8::Local<Value> v8::TryCatch::StackTrace() const {
v8::Local<v8::Message> v8::TryCatch::Message() const {
i::Object* message = reinterpret_cast<i::Object*>(message_obj_);
- DCHECK(message->IsJSMessageObject() || message->IsTheHole());
- if (HasCaught() && !message->IsTheHole()) {
+ DCHECK(message->IsJSMessageObject() || message->IsTheHole(isolate_));
+ if (HasCaught() && !message->IsTheHole(isolate_)) {
return v8::Utils::MessageToLocal(i::Handle<i::Object>(message, isolate_));
} else {
return v8::Local<v8::Message>();
@@ -2687,7 +2686,7 @@ Local<Value> NativeWeakMap::Get(Local<Value> v8_key) {
return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
i::Handle<i::Object> lookup(table->Lookup(key), isolate);
- if (lookup->IsTheHole())
+ if (lookup->IsTheHole(isolate))
return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
return Utils::ToLocal(lookup);
}
@@ -2710,7 +2709,7 @@ bool NativeWeakMap::Has(Local<Value> v8_key) {
return false;
}
i::Handle<i::Object> lookup(table->Lookup(key), isolate);
- return !lookup->IsTheHole();
+ return !lookup->IsTheHole(isolate);
}
@@ -5568,7 +5567,7 @@ static i::Handle<i::Context> CreateEnvironment(
// Migrate security handlers from global_template to
// proxy_template. Temporarily removing access check
// information from the global template.
- if (!global_constructor->access_check_info()->IsUndefined()) {
+ if (!global_constructor->access_check_info()->IsUndefined(isolate)) {
proxy_constructor->set_access_check_info(
global_constructor->access_check_info());
proxy_constructor->set_needs_access_check(
@@ -6942,7 +6941,7 @@ static i::Handle<i::Symbol> SymbolFor(i::Isolate* isolate,
i::Handle<i::Object> symbol =
i::Object::GetPropertyOrElement(symbols, name).ToHandleChecked();
if (!symbol->IsSymbol()) {
- DCHECK(symbol->IsUndefined());
+ DCHECK(symbol->IsUndefined(isolate));
if (private_symbol)
symbol = isolate->factory()->NewPrivateSymbol();
else
@@ -7762,7 +7761,7 @@ void Isolate::RemoveMessageListeners(MessageCallback that) {
i::HandleScope scope(isolate);
NeanderArray listeners(isolate->factory()->message_listeners());
for (int i = 0; i < listeners.length(); i++) {
- if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones
+ if (listeners.get(i)->IsUndefined(isolate)) continue; // skip deleted ones
NeanderObject listener(i::JSObject::cast(listeners.get(i)));
i::Handle<i::Foreign> callback_obj(i::Foreign::cast(listener.get(0)));
« no previous file with comments | « src/accessors.cc ('k') | src/api-arguments.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698