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

Unified Diff: src/execution.cc

Issue 1275013004: [runtime] Simplify TO_INT32/TO_UINT32 abstract operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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/contexts.h ('k') | src/harmony-atomics.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/execution.cc
diff --git a/src/execution.cc b/src/execution.cc
index 687c0f99f9d8be23d213c1b647000fc51c428f0a..52cff2f7900eabe3b554724f3525f449f850a6ad 100644
--- a/src/execution.cc
+++ b/src/execution.cc
@@ -554,18 +554,6 @@ MaybeHandle<Object> Execution::ToInteger(
}
-MaybeHandle<Object> Execution::ToUint32(
- Isolate* isolate, Handle<Object> obj) {
- RETURN_NATIVE_CALL(to_uint32, { obj });
-}
-
-
-MaybeHandle<Object> Execution::ToInt32(
- Isolate* isolate, Handle<Object> obj) {
- RETURN_NATIVE_CALL(to_int32, { obj });
-}
-
-
MaybeHandle<Object> Execution::ToLength(
Isolate* isolate, Handle<Object> obj) {
RETURN_NATIVE_CALL(to_length, { obj });
@@ -581,6 +569,13 @@ MaybeHandle<Object> Execution::NewDate(Isolate* isolate, double time) {
#undef RETURN_NATIVE_CALL
+MaybeHandle<Object> Execution::ToInt32(Isolate* isolate, Handle<Object> obj) {
+ ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Execution::ToNumber(isolate, obj),
+ Object);
+ return isolate->factory()->NewNumberFromInt(DoubleToInt32(obj->Number()));
+}
+
+
MaybeHandle<Object> Execution::ToObject(Isolate* isolate, Handle<Object> obj) {
Handle<JSReceiver> receiver;
if (JSReceiver::ToObject(isolate, obj).ToHandle(&receiver)) {
@@ -591,6 +586,13 @@ MaybeHandle<Object> Execution::ToObject(Isolate* isolate, Handle<Object> obj) {
}
+MaybeHandle<Object> Execution::ToUint32(Isolate* isolate, Handle<Object> obj) {
+ ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Execution::ToNumber(isolate, obj),
+ Object);
+ return isolate->factory()->NewNumberFromUint(DoubleToUint32(obj->Number()));
+}
+
+
MaybeHandle<JSRegExp> Execution::NewJSRegExp(Handle<String> pattern,
Handle<String> flags) {
Isolate* isolate = pattern->GetIsolate();
« no previous file with comments | « src/contexts.h ('k') | src/harmony-atomics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698