Reviewers: Sven Panne,
Message:
ptal
Description:
remove some isolate::currents from api.cc
[email protected]
BUG=
Please review this at https://codereview.chromium.org/691513005/
Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+15, -4 lines):
M src/api.cc
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
2c8009e1d3cd80ccadb86940476edb47a4e148be..4dcd7a04348c94b7c47620efad6c9505f0055643
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3022,8 +3022,17 @@ 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::Isolate* isolate = NULL;
+ if (!obj->IsSmi()) {
+ isolate = i::HeapObject::cast(*obj)->GetIsolate();
+ } else {
+ isolate = i::HeapObject::cast(*other)->GetIsolate();
+ }
if (!Utils::ApiCheck(!obj.is_null() && !that.IsEmpty(),
"v8::Value::Equals()",
"Reading from empty handle")) {
@@ -3031,7 +3040,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.
@@ -3050,15 +3058,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;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.