Reviewers: Kevin Millikin,

Message:
Kevin,

that should have gone with the previous CL, but I just forgot to clean it up,
sorry.

Description:
Follow up to r6540: remove early return from C++ builtin as well.

Please review this at http://codereview.chromium.org/6347037/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/builtins.cc


Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 759ef1d5ade48f8c1539731c56787db9cb90760a..d604226d752dc21ffb3a8d5eb597ce3515abe504 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -734,17 +734,14 @@ BUILTIN(ArraySplice) {

   int n_arguments = args.length() - 1;

-  // Return empty array when no arguments are supplied.
-  if (n_arguments == 0) {
-    return AllocateEmptyJSArray();
-  }
-
   int relative_start = 0;
-  Object* arg1 = args[1];
-  if (arg1->IsSmi()) {
-    relative_start = Smi::cast(arg1)->value();
-  } else if (!arg1->IsUndefined()) {
-    return CallJsBuiltin("ArraySplice", args);
+  if (n_arguments > 0) {
+    Object* arg1 = args[1];
+    if (arg1->IsSmi()) {
+      relative_start = Smi::cast(arg1)->value();
+    } else if (!arg1->IsUndefined()) {
+      return CallJsBuiltin("ArraySplice", args);
+    }
   }
   int actual_start = (relative_start < 0) ? Max(len + relative_start, 0)
                                           : Min(relative_start, len);


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to