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

Unified Diff: src/api.cc

Issue 12459011: Avoid bool to Oddball conversions by being lazy. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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 | « no previous file | src/ast.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 4d91e8f46649a169575d831933879f43cdb657a4..4ec3936be557e3d9df1d7ace82417e99316b2453 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2583,7 +2583,8 @@ Local<Boolean> Value::ToBoolean() const {
}
LOG_API(isolate, "ToBoolean");
ENTER_V8(isolate);
- i::Handle<i::Object> val = i::Execution::ToBoolean(isolate, obj);
+ i::Handle<i::Object> val =
+ isolate->factory()->ToBoolean(obj->BooleanValue());
return Local<Boolean>(ToApi<Boolean>(val));
}
}
@@ -2739,17 +2740,7 @@ void v8::RegExp::CheckCast(v8::Value* that) {
bool Value::BooleanValue() const {
- i::Handle<i::Object> obj = Utils::OpenHandle(this);
- if (obj->IsBoolean()) {
- return obj->IsTrue();
- } else {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::BooleanValue()")) return false;
- LOG_API(isolate, "BooleanValue");
- ENTER_V8(isolate);
- i::Handle<i::Object> value = i::Execution::ToBoolean(isolate, obj);
- return value->IsTrue();
- }
+ return Utils::OpenHandle(this)->BooleanValue();
}
« no previous file with comments | « no previous file | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698