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

Unified Diff: src/api.cc

Issue 691513005: remove some isolate::currents from api.cc (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | 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 3a2e822e85a7349dc43c083d28b435f50585369c..71dc5052a94a6a5027f4c74e68159b911c5180f1 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2896,8 +2896,13 @@ int32_t Value::Int32Value() const {
bool Value::Equals(Handle<Value> that) const {
- i::Isolate* isolate = i::Isolate::Current();
i::Handle<i::Object> obj = Utils::OpenHandle(this, true);
+ i::Handle<i::Object> other = Utils::OpenHandle(*that);
+ if (obj->IsSmi() && other->IsSmi()) {
+ return obj->Number() == other->Number();
+ }
+ i::Object* ho = obj->IsSmi() ? *other : *obj;
+ i::Isolate* isolate = i::HeapObject::cast(ho)->GetIsolate();
if (!Utils::ApiCheck(!obj.is_null() && !that.IsEmpty(),
"v8::Value::Equals()",
"Reading from empty handle")) {
@@ -2905,7 +2910,6 @@ bool Value::Equals(Handle<Value> that) const {
}
LOG_API(isolate, "Equals");
ENTER_V8(isolate);
- i::Handle<i::Object> other = Utils::OpenHandle(*that);
// If both obj and other are JSObjects, we'd better compare by identity
// immediately when going into JS builtin. The reason is Invoke
// would overwrite global object receiver with global proxy.
@@ -2924,15 +2928,18 @@ bool Value::Equals(Handle<Value> that) const {
bool Value::StrictEquals(Handle<Value> that) const {
- i::Isolate* isolate = i::Isolate::Current();
i::Handle<i::Object> obj = Utils::OpenHandle(this, true);
+ i::Handle<i::Object> other = Utils::OpenHandle(*that);
+ if (obj->IsSmi()) {
+ return other->IsNumber() && obj->Number() == other->Number();
+ }
+ i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
if (!Utils::ApiCheck(!obj.is_null() && !that.IsEmpty(),
"v8::Value::StrictEquals()",
"Reading from empty handle")) {
return false;
}
LOG_API(isolate, "StrictEquals");
- i::Handle<i::Object> other = Utils::OpenHandle(*that);
// Must check HeapNumber first, since NaN !== NaN.
if (obj->IsHeapNumber()) {
if (!other->IsNumber()) return false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698