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

Unified Diff: src/api.cc

Issue 873983003: Add HeapNumber fast path to v8::Value::{Uint,Int}32Value() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 | 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 d1e782f7d35af10bfb47e28b6e3f060449cbe06d..19b877823c339f24fc06fd59093d1007cff8f6a6 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2829,8 +2829,8 @@ Local<Uint32> Value::ToArrayIndex() const {
int32_t Value::Int32Value() const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
- if (obj->IsSmi()) {
- return i::Smi::cast(*obj)->value();
+ if (obj->IsNumber()) {
+ return NumberToInt32(*obj);
} else {
i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
LOG_API(isolate, "Int32Value (slow)");
@@ -2930,8 +2930,8 @@ bool Value::SameValue(Handle<Value> that) const {
uint32_t Value::Uint32Value() const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
- if (obj->IsSmi()) {
- return i::Smi::cast(*obj)->value();
+ if (obj->IsNumber()) {
+ return NumberToUint32(*obj);
} else {
i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
LOG_API(isolate, "Uint32Value");
« 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