Revision: 20252
Author:   [email protected]
Date:     Tue Mar 25 14:26:55 2014 UTC
Log:      Refactor optimized in hydrogen only runtime functions.

This splits all runtime function into 3 categories:
1) RUNTIME: implemented in runtime and called from both full and optimized code. 2) RUNTIME_HIDDEN: implemented in runtime, never called directly from JS builtins.
3) INLINE: inlined in both full and optimized code
4) INLINE_OPTIMIZED: inlined in optimized code, implemented in runtime for full code.

[email protected], [email protected]

Review URL: https://codereview.chromium.org/209353006
http://code.google.com/p/v8/source/detail?r=20252

Modified:
 /branches/bleeding_edge/src/arm/code-stubs-arm.cc
 /branches/bleeding_edge/src/arm/full-codegen-arm.cc
 /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
 /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc
 /branches/bleeding_edge/src/arm64/full-codegen-arm64.cc
 /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc
 /branches/bleeding_edge/src/full-codegen.cc
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/hydrogen.h
 /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc
 /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
 /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
 /branches/bleeding_edge/src/mirror-debugger.js
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/src/runtime.h
 /branches/bleeding_edge/src/serialize.cc
 /branches/bleeding_edge/src/typedarray.js
 /branches/bleeding_edge/src/x64/code-stubs-x64.cc
 /branches/bleeding_edge/src/x64/full-codegen-x64.cc
 /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
 /branches/bleeding_edge/test/mjsunit/compiler/dead-string-char-code-at.js
 /branches/bleeding_edge/test/mjsunit/fuzz-natives-part1.js
 /branches/bleeding_edge/test/mjsunit/fuzz-natives-part2.js
 /branches/bleeding_edge/test/mjsunit/fuzz-natives-part3.js
 /branches/bleeding_edge/test/mjsunit/fuzz-natives-part4.js
 /branches/bleeding_edge/test/mjsunit/harmony/generators-objects.js
 /branches/bleeding_edge/test/mjsunit/regress/regress-319722-ArrayBuffer.js
 /branches/bleeding_edge/test/mjsunit/regress/regress-319722-TypedArrays.js

=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Mon Mar 24 10:07:15 2014 UTC +++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Tue Mar 25 14:26:55 2014 UTC
@@ -76,7 +76,7 @@
   descriptor->register_param_count_ = 1;
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kNumberToString)->entry;
+      Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry;
 }


@@ -141,7 +141,7 @@
   descriptor->register_param_count_ = 3;
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry;
+      Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry;
 }


@@ -385,7 +385,7 @@
   descriptor->register_param_count_ = 2;
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kStringAdd)->entry;
+      Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry;
 }


@@ -2830,7 +2830,7 @@

   // Do the runtime call to execute the regexp.
   __ bind(&runtime);
-  __ TailCallRuntime(Runtime::kRegExpExec, 4, 1);
+  __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1);

   // Deferred code for string handling.
   // (6) Not a long external string?  If yes, go to (8).
@@ -3225,7 +3225,7 @@
   call_helper.BeforeCall(masm);
   __ SmiTag(index_);
   __ Push(object_, index_);
-  __ CallRuntime(Runtime::kStringCharCodeAt, 2);
+  __ CallRuntime(Runtime::kHiddenStringCharCodeAt, 2);
   __ Move(result_, r0);
   call_helper.AfterCall(masm);
   __ jmp(&exit_);
@@ -3673,7 +3673,7 @@

   // Just jump to runtime to create the sub string.
   __ bind(&runtime);
-  __ TailCallRuntime(Runtime::kSubString, 3, 1);
+  __ TailCallRuntime(Runtime::kHiddenSubString, 3, 1);

   __ bind(&single_char);
   // r0: original string
@@ -3831,7 +3831,7 @@
   // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
   // tagged as a small integer.
   __ bind(&runtime);
-  __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
+  __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
 }


@@ -4318,7 +4318,7 @@
   if (equality) {
     __ TailCallRuntime(Runtime::kStringEquals, 2, 1);
   } else {
-    __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
+    __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
   }

   __ bind(&miss);
=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Mon Mar 24 08:17:06 2014 UTC +++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Tue Mar 25 14:26:55 2014 UTC
@@ -3404,7 +3404,7 @@
   if (CodeGenerator::ShouldGenerateLog(isolate(), args->at(0))) {
     VisitForStackValue(args->at(1));
     VisitForStackValue(args->at(2));
-    __ CallRuntime(Runtime::kLog, 2);
+    __ CallRuntime(Runtime::kHiddenLog, 2);
   }

   // Finally, we're expected to leave a value on the top of the stack.
@@ -3867,7 +3867,7 @@
   __ bind(&not_found);
   // Call runtime to perform the lookup.
   __ Push(cache, key);
-  __ CallRuntime(Runtime::kGetFromCache, 2);
+  __ CallRuntime(Runtime::kHiddenGetFromCache, 2);

   __ bind(&done);
   context()->Plug(r0);
@@ -4144,8 +4144,8 @@


 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
-  Handle<String> name = expr->name();
-  if (name->length() > 0 && name->Get(0) == '_') {
+  if (expr->function() != NULL &&
+      expr->function()->intrinsic_type == Runtime::INLINE) {
     Comment cmnt(masm_, "[ InlineRuntimeCall");
     EmitInlineRuntimeCall(expr);
     return;
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Mar 24 13:16:23 2014 UTC +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Tue Mar 25 14:26:55 2014 UTC
@@ -4463,7 +4463,7 @@
     __ SmiTag(index);
     __ push(index);
   }
-  CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr,
+  CallRuntimeFromDeferred(Runtime::kHiddenStringCharCodeAt, 2, instr,
                           instr->context());
   __ AssertSmi(r0);
   __ SmiUntag(r0);
=======================================
--- /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc Mon Mar 24 16:41:37 2014 UTC +++ /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc Tue Mar 25 14:26:55 2014 UTC
@@ -80,7 +80,7 @@
descriptor->register_param_count_ = sizeof(registers) / sizeof(registers[0]);
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kNumberToString)->entry;
+      Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry;
 }


@@ -161,7 +161,7 @@
descriptor->register_param_count_ = sizeof(registers) / sizeof(registers[0]);
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry;
+      Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry;
 }


@@ -429,7 +429,7 @@
descriptor->register_param_count_ = sizeof(registers) / sizeof(registers[0]);
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kStringAdd)->entry;
+      Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry;
 }


@@ -3134,7 +3134,7 @@

   __ Bind(&runtime);
   __ PopCPURegList(used_callee_saved_registers);
-  __ TailCallRuntime(Runtime::kRegExpExec, 4, 1);
+  __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1);

   // Deferred code for string handling.
   // (6) Not a long external string?  If yes, go to (8).
@@ -3550,7 +3550,7 @@
   call_helper.BeforeCall(masm);
   __ SmiTag(index_);
   __ Push(object_, index_);
-  __ CallRuntime(Runtime::kStringCharCodeAt, 2);
+  __ CallRuntime(Runtime::kHiddenStringCharCodeAt, 2);
   __ Mov(result_, x0);
   call_helper.AfterCall(masm);
   __ B(&exit_);
@@ -3832,7 +3832,7 @@
   if (equality) {
     __ TailCallRuntime(Runtime::kStringEquals, 2, 1);
   } else {
-    __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
+    __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
   }

   __ Bind(&miss);
@@ -4222,7 +4222,7 @@
   __ Ret();

   __ Bind(&runtime);
-  __ TailCallRuntime(Runtime::kSubString, 3, 1);
+  __ TailCallRuntime(Runtime::kHiddenSubString, 3, 1);

   __ bind(&single_char);
   // x1: result_length
@@ -4399,7 +4399,7 @@

   // Call the runtime.
// Returns -1 (less), 0 (equal), or 1 (greater) tagged as a small integer.
-  __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
+  __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
 }


=======================================
--- /branches/bleeding_edge/src/arm64/full-codegen-arm64.cc Mon Mar 24 08:17:06 2014 UTC +++ /branches/bleeding_edge/src/arm64/full-codegen-arm64.cc Tue Mar 25 14:26:55 2014 UTC
@@ -3137,7 +3137,7 @@
   if (CodeGenerator::ShouldGenerateLog(isolate(), args->at(0))) {
     VisitForStackValue(args->at(1));
     VisitForStackValue(args->at(2));
-    __ CallRuntime(Runtime::kLog, 2);
+    __ CallRuntime(Runtime::kHiddenLog, 2);
   }

   // Finally, we're expected to leave a value on the top of the stack.
@@ -3598,7 +3598,7 @@

   // Call runtime to perform the lookup.
   __ Push(cache, key);
-  __ CallRuntime(Runtime::kGetFromCache, 2);
+  __ CallRuntime(Runtime::kHiddenGetFromCache, 2);

   __ Bind(&done);
   context()->Plug(x0);
@@ -3856,8 +3856,8 @@


 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
-  Handle<String> name = expr->name();
-  if (name->length() > 0 && name->Get(0) == '_') {
+  if (expr->function() != NULL &&
+      expr->function()->intrinsic_type == Runtime::INLINE) {
     Comment cmnt(masm_, "[ InlineRuntimeCall");
     EmitInlineRuntimeCall(expr);
     return;
@@ -3874,6 +3874,7 @@
     __ Push(x0);

     // Load the function from the receiver.
+    Handle<String> name = expr->name();
     __ Mov(x2, Operand(name));
     CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());

=======================================
--- /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Tue Mar 25 13:45:17 2014 UTC +++ /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Tue Mar 25 14:26:55 2014 UTC
@@ -5406,7 +5406,7 @@
   __ SmiTag(index);
   __ Push(index);

-  CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr,
+  CallRuntimeFromDeferred(Runtime::kHiddenStringCharCodeAt, 2, instr,
                           instr->context());
   __ AssertSmi(x0);
   __ SmiUntag(x0);
=======================================
--- /branches/bleeding_edge/src/full-codegen.cc Tue Mar 25 14:12:58 2014 UTC
+++ /branches/bleeding_edge/src/full-codegen.cc Tue Mar 25 14:26:55 2014 UTC
@@ -950,59 +950,6 @@
 void FullCodeGenerator::EmitDebugBreakInOptimizedCode(CallRuntime* expr) {
   context()->Plug(handle(Smi::FromInt(0), isolate()));
 }
-
-
-void FullCodeGenerator::EmitDoubleHi(CallRuntime* expr) {
-  ZoneList<Expression*>* args = expr->arguments();
-  ASSERT(args->length() == 1);
-  VisitForStackValue(args->at(0));
-  masm()->CallRuntime(Runtime::kDoubleHi, 1);
-  context()->Plug(result_register());
-}
-
-
-void FullCodeGenerator::EmitDoubleLo(CallRuntime* expr) {
-  ZoneList<Expression*>* args = expr->arguments();
-  ASSERT(args->length() == 1);
-  VisitForStackValue(args->at(0));
-  masm()->CallRuntime(Runtime::kDoubleLo, 1);
-  context()->Plug(result_register());
-}
-
-
-void FullCodeGenerator::EmitConstructDouble(CallRuntime* expr) {
-  ZoneList<Expression*>* args = expr->arguments();
-  ASSERT(args->length() == 2);
-  VisitForStackValue(args->at(0));
-  VisitForStackValue(args->at(1));
-  masm()->CallRuntime(Runtime::kConstructDouble, 2);
-  context()->Plug(result_register());
-}
-
-
-void FullCodeGenerator::EmitTypedArrayInitialize(CallRuntime* expr) {
-  ZoneList<Expression*>* args = expr->arguments();
-  ASSERT(args->length() == 5);
-  for (int i = 0; i < 5; i++) VisitForStackValue(args->at(i));
-  masm()->CallRuntime(Runtime::kTypedArrayInitialize, 5);
-  context()->Plug(result_register());
-}
-
-
-void FullCodeGenerator::EmitDataViewInitialize(CallRuntime* expr) {
-  ZoneList<Expression*>* args = expr->arguments();
-  ASSERT(args->length() == 4);
-  for (int i = 0; i < 4; i++) VisitForStackValue(args->at(i));
-  masm()->CallRuntime(Runtime::kDataViewInitialize, 4);
-  context()->Plug(result_register());
-}
-
-
-void FullCodeGenerator::EmitMaxSmi(CallRuntime* expr) {
-  ASSERT(expr->arguments()->length() == 0);
-  masm()->CallRuntime(Runtime::kMaxSmi, 0);
-  context()->Plug(result_register());
-}


 void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Tue Mar 25 14:12:58 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc     Tue Mar 25 14:26:55 2014 UTC
@@ -2069,9 +2069,10 @@
       // Fallback to the runtime to add the two strings.
       Add<HPushArgument>(left);
       Add<HPushArgument>(right);
-      Push(Add<HCallRuntime>(isolate()->factory()->empty_string(),
-                             Runtime::FunctionForId(Runtime::kStringAdd),
-                             2));
+      Push(Add<HCallRuntime>(
+            isolate()->factory()->empty_string(),
+            Runtime::FunctionForId(Runtime::kHiddenStringAdd),
+            2));
     }
     if_sameencodingandsequential.End();
   }
@@ -8400,6 +8401,7 @@
 const HOptimizedGraphBuilder::InlineFunctionGenerator
     HOptimizedGraphBuilder::kInlineFunctionGenerators[] = {
         INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS)
+        INLINE_OPTIMIZED_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS)
 };
 #undef INLINE_FUNCTION_GENERATOR_ADDRESS

@@ -8602,7 +8604,8 @@
   const Runtime::Function* function = expr->function();
   ASSERT(function != NULL);

-  if (function->intrinsic_type == Runtime::INLINE) {
+  if (function->intrinsic_type == Runtime::INLINE ||
+      function->intrinsic_type == Runtime::INLINE_OPTIMIZED) {
     ASSERT(expr->name()->length() > 0);
     ASSERT(expr->name()->Get(0) == '_');
     // Call to an inline function.
=======================================
--- /branches/bleeding_edge/src/hydrogen.h      Tue Mar 25 14:12:58 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.h      Tue Mar 25 14:26:55 2014 UTC
@@ -2120,6 +2120,7 @@
   void Generate##Name(CallRuntime* call);

   INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION)
+  INLINE_OPTIMIZED_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION)
 #undef INLINE_FUNCTION_GENERATOR_DECLARATION

   void VisitDelete(UnaryOperation* expr);
=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Mon Mar 24 13:00:05 2014 UTC +++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Tue Mar 25 14:26:55 2014 UTC
@@ -81,7 +81,7 @@
   descriptor->register_param_count_ = 1;
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kNumberToString)->entry;
+      Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry;
 }


@@ -146,7 +146,7 @@
   descriptor->register_param_count_ = 3;
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry;
+      Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry;
 }


@@ -388,7 +388,7 @@
   descriptor->register_param_count_ = 2;
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kStringAdd)->entry;
+      Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry;
 }


@@ -1863,7 +1863,7 @@

   // Do the runtime call to execute the regexp.
   __ bind(&runtime);
-  __ TailCallRuntime(Runtime::kRegExpExec, 4, 1);
+  __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1);

   // Deferred code for string handling.
   // (7) Not a long external string?  If yes, go to (10).
@@ -3155,7 +3155,7 @@
   __ push(object_);
   __ SmiTag(index_);
   __ push(index_);
-  __ CallRuntime(Runtime::kStringCharCodeAt, 2);
+  __ CallRuntime(Runtime::kHiddenStringCharCodeAt, 2);
   if (!result_.is(eax)) {
     __ mov(result_, eax);
   }
@@ -3551,7 +3551,7 @@

   // Just jump to runtime to create the sub string.
   __ bind(&runtime);
-  __ TailCallRuntime(Runtime::kSubString, 3, 1);
+  __ TailCallRuntime(Runtime::kHiddenSubString, 3, 1);

   __ bind(&single_char);
   // eax: string
@@ -3733,7 +3733,7 @@
   // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
   // tagged as a small integer.
   __ bind(&runtime);
-  __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
+  __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
 }


@@ -4256,7 +4256,7 @@
   if (equality) {
     __ TailCallRuntime(Runtime::kStringEquals, 2, 1);
   } else {
-    __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
+    __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
   }

   __ bind(&miss);
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Mon Mar 24 13:00:05 2014 UTC +++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Tue Mar 25 14:26:55 2014 UTC
@@ -3360,7 +3360,7 @@
   if (CodeGenerator::ShouldGenerateLog(isolate(), args->at(0))) {
     VisitForStackValue(args->at(1));
     VisitForStackValue(args->at(2));
-    __ CallRuntime(Runtime::kLog, 2);
+    __ CallRuntime(Runtime::kHiddenLog, 2);
   }
   // Finally, we're expected to leave a value on the top of the stack.
   __ mov(eax, isolate()->factory()->undefined_value());
@@ -3835,7 +3835,7 @@
   // Call runtime to perform the lookup.
   __ push(cache);
   __ push(key);
-  __ CallRuntime(Runtime::kGetFromCache, 2);
+  __ CallRuntime(Runtime::kHiddenGetFromCache, 2);

   __ bind(&done);
   context()->Plug(eax);
@@ -4145,8 +4145,8 @@


 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
-  Handle<String> name = expr->name();
-  if (name->length() > 0 && name->Get(0) == '_') {
+  if (expr->function() != NULL &&
+      expr->function()->intrinsic_type == Runtime::INLINE) {
     Comment cmnt(masm_, "[ InlineRuntimeCall");
     EmitInlineRuntimeCall(expr);
     return;
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon Mar 24 16:25:48 2014 UTC +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Tue Mar 25 14:26:55 2014 UTC
@@ -4802,7 +4802,7 @@
     __ SmiTag(index);
     __ push(index);
   }
-  CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2,
+  CallRuntimeFromDeferred(Runtime::kHiddenStringCharCodeAt, 2,
                           instr, instr->context());
   __ AssertSmi(eax);
   __ SmiUntag(eax);
=======================================
--- /branches/bleeding_edge/src/mirror-debugger.js Fri Mar 21 12:30:58 2014 UTC +++ /branches/bleeding_edge/src/mirror-debugger.js Tue Mar 25 14:26:55 2014 UTC
@@ -538,7 +538,7 @@


 NumberMirror.prototype.toText = function() {
-  return %NumberToString(this.value_);
+  return %_NumberToString(this.value_);
 };


=======================================
--- /branches/bleeding_edge/src/runtime.cc      Tue Mar 25 14:12:58 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Tue Mar 25 14:26:55 2014 UTC
@@ -2544,7 +2544,7 @@
 }


-RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpExec) {
+RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_RegExpExec) {
   HandleScope scope(isolate);
   ASSERT(args.length() == 4);
   CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
@@ -2565,7 +2565,7 @@
 }


-RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpConstructResult) {
+RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_RegExpConstructResult) {
   SealHandleScope shs(isolate);
   ASSERT(args.length() == 3);
   CONVERT_SMI_ARG_CHECKED(elements_count, 0);
@@ -3227,7 +3227,7 @@
 }


-RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCharCodeAt) {
+RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_StringCharCodeAt) {
   SealHandleScope shs(isolate);
   ASSERT(args.length() == 2);

@@ -4497,7 +4497,7 @@
 }


-RUNTIME_FUNCTION(MaybeObject*, Runtime_SubString) {
+RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_SubString) {
   HandleScope scope(isolate);
   ASSERT(args.length() == 3);

@@ -6861,7 +6861,7 @@
 }


-RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToString) {
+RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NumberToString) {
   SealHandleScope shs(isolate);
   ASSERT(args.length() == 1);

@@ -7065,7 +7065,7 @@
 }


-RUNTIME_FUNCTION(MaybeObject*, Runtime_StringAdd) {
+RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_StringAdd) {
   HandleScope scope(isolate);
   ASSERT(args.length() == 2);
   CONVERT_ARG_HANDLE_CHECKED(String, str1, 0);
@@ -7688,7 +7688,7 @@
 }


-RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCompare) {
+RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_StringCompare) {
   SealHandleScope shs(isolate);
   ASSERT(args.length() == 2);

@@ -14530,7 +14530,7 @@
 }


-RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFromCache) {
+RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_GetFromCache) {
   SealHandleScope shs(isolate);
   // This is only called from codegen, so checks might be more lax.
   CONVERT_ARG_CHECKED(JSFunctionResultCache, cache, 0);
@@ -14652,6 +14652,7 @@
 #define COUNT_ENTRY(Name, argc, ressize) + 1
   int entry_count = 0
       RUNTIME_FUNCTION_LIST(COUNT_ENTRY)
+      RUNTIME_HIDDEN_FUNCTION_LIST(COUNT_ENTRY)
       INLINE_FUNCTION_LIST(COUNT_ENTRY);
 #undef COUNT_ENTRY
   Factory* factory = isolate->factory();
@@ -14678,6 +14679,8 @@
   }
   inline_runtime_functions = false;
   RUNTIME_FUNCTION_LIST(ADD_ENTRY)
+  // Calling hidden runtime functions should just throw.
+  RUNTIME_HIDDEN_FUNCTION_LIST(ADD_ENTRY)
   inline_runtime_functions = true;
   INLINE_FUNCTION_LIST(ADD_ENTRY)
 #undef ADD_ENTRY
@@ -14688,7 +14691,7 @@
 #endif


-RUNTIME_FUNCTION(MaybeObject*, Runtime_Log) {
+RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_Log) {
   HandleScope handle_scope(isolate);
   ASSERT(args.length() == 2);
   CONVERT_ARG_HANDLE_CHECKED(String, format, 0);
@@ -15033,16 +15036,31 @@
     FUNCTION_ADDR(Runtime_##name), number_of_args, result_size },


+#define FH(name, number_of_args, result_size)                             \
+  { Runtime::kHidden##name, Runtime::RUNTIME_HIDDEN, NULL,   \
+    FUNCTION_ADDR(RuntimeHidden_##name), number_of_args, result_size },
+
+
 #define I(name, number_of_args, result_size)                             \
   { Runtime::kInline##name, Runtime::INLINE,     \
     "_" #name, NULL, number_of_args, result_size },

+
+#define IO(name, number_of_args, result_size) \
+  { Runtime::kInlineOptimized##name, Runtime::INLINE_OPTIMIZED, \
+ "_" #name, FUNCTION_ADDR(Runtime_##name), number_of_args, result_size },
+
+
 static const Runtime::Function kIntrinsicFunctions[] = {
   RUNTIME_FUNCTION_LIST(F)
+  RUNTIME_HIDDEN_FUNCTION_LIST(FH)
   INLINE_FUNCTION_LIST(I)
+  INLINE_OPTIMIZED_FUNCTION_LIST(IO)
 };

+#undef IO
 #undef I
+#undef FH
 #undef F


@@ -15051,9 +15069,11 @@
   ASSERT(dictionary != NULL);
   ASSERT(NameDictionary::cast(dictionary)->NumberOfElements() == 0);
   for (int i = 0; i < kNumFunctions; ++i) {
+    const char* name = kIntrinsicFunctions[i].name;
+    if (name == NULL) continue;
     Object* name_string;
     { MaybeObject* maybe_name_string =
-          heap->InternalizeUtf8String(kIntrinsicFunctions[i].name);
+          heap->InternalizeUtf8String(name);
if (!maybe_name_string->ToObject(&name_string)) return maybe_name_string;
     }
     NameDictionary* name_dictionary = NameDictionary::cast(dictionary);
=======================================
--- /branches/bleeding_edge/src/runtime.h       Tue Mar 25 14:12:58 2014 UTC
+++ /branches/bleeding_edge/src/runtime.h       Tue Mar 25 14:26:55 2014 UTC
@@ -594,14 +594,28 @@
 // RUNTIME_FUNCTION_LIST defines all runtime functions accessed
 // either directly by id (via the code generator), or indirectly
 // via a native call by name (from within JS code).
+// Entries have the form F(name, number of arguments, number of return values).

 #define RUNTIME_FUNCTION_LIST(F) \
   RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \
   RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \
   RUNTIME_FUNCTION_LIST_DEBUG(F) \
   RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \
-  RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) \
-  INLINE_RUNTIME_FUNCTION_LIST(F)
+  RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F)
+
+// RUNTIME_HIDDEN_FUNCTION_LIST defines all runtime functions accessed
+// by id from code generator, but not via native call by name.
+// Entries have the form F(name, number of arguments, number of return values).
+#define RUNTIME_HIDDEN_FUNCTION_LIST(F) \
+  F(NumberToString, 1, 1) \
+  F(RegExpConstructResult, 3, 1) \
+  F(RegExpExec, 4, 1) \
+  F(StringAdd, 2, 1)  \
+  F(SubString, 3, 1) \
+  F(StringCompare, 2, 1) \
+  F(StringCharCodeAt, 2, 1) \
+  F(Log, 3, 1) \
+  F(GetFromCache, 2, 1)

// ----------------------------------------------------------------------------
 // INLINE_FUNCTION_LIST defines all inlined functions accessed
@@ -639,15 +653,6 @@
F(GeneratorNext, 2, 1) \ F(GeneratorThrow, 2, 1) \ F(DebugBreakInOptimizedCode, 0, 1) \
-  INLINE_RUNTIME_FUNCTION_LIST(F)
-
-
-// ----------------------------------------------------------------------------
-// INLINE_RUNTIME_FUNCTION_LIST defines all inlined functions accessed
-// with a native call of the form %_name from within JS code that also have
-// a corresponding runtime function, that is called for slow cases.
-// Entries have the form F(name, number of arguments, number of return values).
-#define INLINE_RUNTIME_FUNCTION_LIST(F) \
F(ClassOf, 1, 1) \ F(StringCharCodeAt, 2, 1) \ F(Log, 3, 1) \
@@ -657,7 +662,15 @@
F(RegExpExec, 4, 1) \ F(RegExpConstructResult, 3, 1) \ F(GetFromCache, 2, 1) \ - F(NumberToString, 1, 1) \
+  F(NumberToString, 1, 1)
+
+
+// ----------------------------------------------------------------------------
+// INLINE_OPTIMIZED_FUNCTION_LIST defines all inlined functions accessed
+// with a native call of the form %_name from within JS code that also have
+// a corresponding runtime function, that is called from non-optimized code. +// Entries have the form F(name, number of arguments, number of return values).
+#define INLINE_OPTIMIZED_FUNCTION_LIST(F) \
F(DoubleHi, 1, 1) \ F(DoubleLo, 1, 1) \ F(ConstructDouble, 2, 1) \
@@ -717,16 +730,24 @@
 #define F(name, nargs, ressize) k##name,
     RUNTIME_FUNCTION_LIST(F)
 #undef F
+#define F(name, nargs, ressize) kHidden##name,
+    RUNTIME_HIDDEN_FUNCTION_LIST(F)
+#undef F
 #define F(name, nargs, ressize) kInline##name,
     INLINE_FUNCTION_LIST(F)
 #undef F
+#define F(name, nargs, ressize) kInlineOptimized##name,
+    INLINE_OPTIMIZED_FUNCTION_LIST(F)
+#undef F
     kNumFunctions,
     kFirstInlineFunction = kInlineIsSmi
   };

   enum IntrinsicType {
     RUNTIME,
-    INLINE
+    RUNTIME_HIDDEN,
+    INLINE,
+    INLINE_OPTIMIZED
   };

   // Intrinsic function descriptor.
=======================================
--- /branches/bleeding_edge/src/serialize.cc    Wed Mar 12 15:23:54 2014 UTC
+++ /branches/bleeding_edge/src/serialize.cc    Tue Mar 25 14:26:55 2014 UTC
@@ -175,6 +175,22 @@
   RUNTIME_FUNCTION_LIST(RUNTIME_ENTRY)
 #undef RUNTIME_ENTRY

+#define RUNTIME_HIDDEN_ENTRY(name, nargs, ressize) \
+  { RUNTIME_FUNCTION, \
+    Runtime::kHidden##name, \
+    "Runtime::Hidden" #name },
+
+  RUNTIME_HIDDEN_FUNCTION_LIST(RUNTIME_HIDDEN_ENTRY)
+#undef RUNTIME_HIDDEN_ENTRY
+
+#define INLINE_OPTIMIZED_ENTRY(name, nargs, ressize) \
+  { RUNTIME_FUNCTION, \
+    Runtime::kInlineOptimized##name, \
+    "Runtime::" #name },
+
+  INLINE_OPTIMIZED_FUNCTION_LIST(INLINE_OPTIMIZED_ENTRY)
+#undef INLINE_OPTIMIZED_ENTRY
+
   // IC utilities
 #define IC_ENTRY(name) \
   { IC_UTILITY, \
=======================================
--- /branches/bleeding_edge/src/typedarray.js   Tue Mar 25 14:12:58 2014 UTC
+++ /branches/bleeding_edge/src/typedarray.js   Tue Mar 25 14:26:55 2014 UTC
@@ -257,7 +257,7 @@
     throw MakeTypeError("typed_array_set_negative_offset");
   }

-  if (intOffset > %MaxSmi()) {
+  if (intOffset > %_MaxSmi()) {
     throw MakeRangeError("typed_array_set_source_too_large");
   }
   switch (%TypedArraySetFastCases(this, obj, intOffset)) {
=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.cc Mon Mar 24 10:18:27 2014 UTC +++ /branches/bleeding_edge/src/x64/code-stubs-x64.cc Tue Mar 25 14:26:55 2014 UTC
@@ -77,7 +77,7 @@
   descriptor->register_param_count_ = 1;
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kNumberToString)->entry;
+      Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry;
 }


@@ -142,7 +142,7 @@
   descriptor->register_param_count_ = 3;
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry;
+      Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry;
 }


@@ -385,7 +385,7 @@
   descriptor->register_param_count_ = 2;
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kStringAdd)->entry;
+      Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry;
 }


@@ -1734,7 +1734,7 @@

   // Do the runtime call to execute the regexp.
   __ bind(&runtime);
-  __ TailCallRuntime(Runtime::kRegExpExec, 4, 1);
+  __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1);

   // Deferred code for string handling.
   // (7) Not a long external string?  If yes, go to (10).
@@ -3034,7 +3034,7 @@
   __ Push(object_);
   __ Integer32ToSmi(index_, index_);
   __ Push(index_);
-  __ CallRuntime(Runtime::kStringCharCodeAt, 2);
+  __ CallRuntime(Runtime::kHiddenStringCharCodeAt, 2);
   if (!result_.is(rax)) {
     __ movp(result_, rax);
   }
@@ -3409,7 +3409,7 @@

   // Just jump to runtime to create the sub string.
   __ bind(&runtime);
-  __ TailCallRuntime(Runtime::kSubString, 3, 1);
+  __ TailCallRuntime(Runtime::kHiddenSubString, 3, 1);

   __ bind(&single_char);
   // rax: string
@@ -3606,7 +3606,7 @@
   // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
   // tagged as a small integer.
   __ bind(&runtime);
-  __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
+  __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
 }


@@ -4101,7 +4101,7 @@
   if (equality) {
     __ TailCallRuntime(Runtime::kStringEquals, 2, 1);
   } else {
-    __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
+    __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
   }

   __ bind(&miss);
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Mon Mar 24 10:18:27 2014 UTC +++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Tue Mar 25 14:26:55 2014 UTC
@@ -3339,7 +3339,7 @@
   if (CodeGenerator::ShouldGenerateLog(isolate(), args->at(0))) {
     VisitForStackValue(args->at(1));
     VisitForStackValue(args->at(2));
-    __ CallRuntime(Runtime::kLog, 2);
+    __ CallRuntime(Runtime::kHiddenLog, 2);
   }
   // Finally, we're expected to leave a value on the top of the stack.
   __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
@@ -3814,7 +3814,7 @@
   // Call runtime to perform the lookup.
   __ Push(cache);
   __ Push(key);
-  __ CallRuntime(Runtime::kGetFromCache, 2);
+  __ CallRuntime(Runtime::kHiddenGetFromCache, 2);

   __ bind(&done);
   context()->Plug(rax);
@@ -4145,8 +4145,8 @@


 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
-  Handle<String> name = expr->name();
-  if (name->length() > 0 && name->Get(0) == '_') {
+  if (expr->function() != NULL &&
+      expr->function()->intrinsic_type == Runtime::INLINE) {
     Comment cmnt(masm_, "[ InlineRuntimeCall");
     EmitInlineRuntimeCall(expr);
     return;
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Mar 25 13:26:41 2014 UTC +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Mar 25 14:26:55 2014 UTC
@@ -4461,7 +4461,7 @@
     __ Push(index);
   }
   CallRuntimeFromDeferred(
-      Runtime::kStringCharCodeAt, 2, instr, instr->context());
+      Runtime::kHiddenStringCharCodeAt, 2, instr, instr->context());
   __ AssertSmi(rax);
   __ SmiToInteger32(rax, rax);
   __ StoreToSafepointRegisterSlot(result, rax);
=======================================
--- /branches/bleeding_edge/test/mjsunit/compiler/dead-string-char-code-at.js Mon Jul 29 12:35:43 2013 UTC +++ /branches/bleeding_edge/test/mjsunit/compiler/dead-string-char-code-at.js Tue Mar 25 14:26:55 2014 UTC
@@ -31,21 +31,21 @@
 var S2 = "@@string2";

 function dead1(a, b) {
-    var x = %StringCharCodeAt(a, 4);
+    var x = %_StringCharCodeAt(a, 4);
     return a; // x is dead code
 }

 function dead2(a, b) {
-    var x = %StringCharCodeAt(a, 3);
-    var y = %StringCharCodeAt(b, 1);
+    var x = %_StringCharCodeAt(a, 3);
+    var y = %_StringCharCodeAt(b, 1);
     return a; // x and y are both dead
 }

 function dead3(a, b) {
     a = a ? "11" : "12";
     b = b ? "13" : "14";
-    var x = %StringCharCodeAt(a, 2);
-    var y = %StringCharCodeAt(b, 0);
+    var x = %_StringCharCodeAt(a, 2);
+    var y = %_StringCharCodeAt(b, 0);
     return a; // x and y are both dead
 }

=======================================
--- /branches/bleeding_edge/test/mjsunit/fuzz-natives-part1.js Mon Mar 24 08:22:24 2014 UTC +++ /branches/bleeding_edge/test/mjsunit/fuzz-natives-part1.js Tue Mar 25 14:26:55 2014 UTC
@@ -161,7 +161,6 @@
   "CreateArrayLiteralBoilerplate": true,
   "IS_VAR": true,
   "ResolvePossiblyDirectEval": true,
-  "Log": true,
   "DeclareGlobals": true,
   "ArrayConstructor": true,
   "InternalArrayConstructor": true,
=======================================
--- /branches/bleeding_edge/test/mjsunit/fuzz-natives-part2.js Mon Mar 24 08:22:24 2014 UTC +++ /branches/bleeding_edge/test/mjsunit/fuzz-natives-part2.js Tue Mar 25 14:26:55 2014 UTC
@@ -161,7 +161,6 @@
   "CreateArrayLiteralBoilerplate": true,
   "IS_VAR": true,
   "ResolvePossiblyDirectEval": true,
-  "Log": true,
   "DeclareGlobals": true,
   "ArrayConstructor": true,
   "InternalArrayConstructor": true,
=======================================
--- /branches/bleeding_edge/test/mjsunit/fuzz-natives-part3.js Mon Mar 24 08:22:24 2014 UTC +++ /branches/bleeding_edge/test/mjsunit/fuzz-natives-part3.js Tue Mar 25 14:26:55 2014 UTC
@@ -161,7 +161,6 @@
   "CreateArrayLiteralBoilerplate": true,
   "IS_VAR": true,
   "ResolvePossiblyDirectEval": true,
-  "Log": true,
   "DeclareGlobals": true,
   "ArrayConstructor": true,
   "InternalArrayConstructor": true,
=======================================
--- /branches/bleeding_edge/test/mjsunit/fuzz-natives-part4.js Mon Mar 24 08:22:24 2014 UTC +++ /branches/bleeding_edge/test/mjsunit/fuzz-natives-part4.js Tue Mar 25 14:26:55 2014 UTC
@@ -161,7 +161,6 @@
   "CreateArrayLiteralBoilerplate": true,
   "IS_VAR": true,
   "ResolvePossiblyDirectEval": true,
-  "Log": true,
   "DeclareGlobals": true,
   "ArrayConstructor": true,
   "InternalArrayConstructor": true,
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/generators-objects.js Mon Jun 10 09:26:18 2013 UTC +++ /branches/bleeding_edge/test/mjsunit/harmony/generators-objects.js Tue Mar 25 14:26:55 2014 UTC
@@ -55,7 +55,7 @@
   var iter = g();
   assertSame(g.prototype, Object.getPrototypeOf(iter));
   assertTrue(iter instanceof g);
-  assertEquals("Generator", %ClassOf(iter));
+  assertEquals("Generator", %_ClassOf(iter));
   assertEquals("[object Generator]", String(iter));
   assertEquals([], Object.getOwnPropertyNames(iter));
   assertTrue(iter !== g());
@@ -64,7 +64,7 @@
   iter = new g();
   assertSame(g.prototype, Object.getPrototypeOf(iter));
   assertTrue(iter instanceof g);
-  assertEquals("Generator", %ClassOf(iter));
+  assertEquals("Generator", %_ClassOf(iter));
   assertEquals("[object Generator]", String(iter));
   assertEquals([], Object.getOwnPropertyNames(iter));
   assertTrue(iter !== new g());
=======================================
--- /branches/bleeding_edge/test/mjsunit/regress/regress-319722-ArrayBuffer.js Fri Nov 22 13:50:39 2013 UTC +++ /branches/bleeding_edge/test/mjsunit/regress/regress-319722-ArrayBuffer.js Tue Mar 25 14:26:55 2014 UTC
@@ -26,7 +26,7 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// Flags: --nostress-opt --allow-natives-syntax --mock-arraybuffer-allocator
-var maxSize = %MaxSmi() + 1;
+var maxSize = %_MaxSmi() + 1;
 var ab;

 // Allocate the largest ArrayBuffer we can on this architecture.
=======================================
--- /branches/bleeding_edge/test/mjsunit/regress/regress-319722-TypedArrays.js Fri Nov 15 16:37:15 2013 UTC +++ /branches/bleeding_edge/test/mjsunit/regress/regress-319722-TypedArrays.js Tue Mar 25 14:26:55 2014 UTC
@@ -27,7 +27,7 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 // Flags: --nostress-opt --allow-natives-syntax
-var maxSize = %MaxSmi() + 1;
+var maxSize = %_MaxSmi() + 1;
 function TestArray(constr) {
   assertThrows(function() {
     new constr(maxSize);

--
--
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.

Reply via email to