Revision: 22070
Author:   [email protected]
Date:     Sat Jun 28 00:33:04 2014 UTC
Log: Support non-internalized string key lookups in Hydrogen KeyedLoadIC

[email protected]

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

Added:
 /branches/bleeding_edge/test/mjsunit/runtime-gen/internalizestring.js
Modified:
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/src/runtime.h
 /branches/bleeding_edge/tools/generate-runtime-tests.py

=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/runtime-gen/internalizestring.js Sat Jun 28 00:33:04 2014 UTC
@@ -0,0 +1,5 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY
+// Flags: --allow-natives-syntax --harmony
+var _string = "foo";
+%InternalizeString(_string);
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Fri Jun 27 11:04:35 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc     Sat Jun 28 00:33:04 2014 UTC
@@ -1513,13 +1513,23 @@
               Token::BIT_AND,
               instance_type,
               Add<HConstant>(static_cast<int>(kIsNotInternalizedMask)));
-          DeoptimizeIf<HCompareNumericAndBranch>(
-              not_internalized_bit,
-              graph()->GetConstant0(),
-              Token::NE,
-              "BuildKeyedIndexCheck: string isn't internalized");
-          // Key guaranteed to be a unqiue string
+
+          IfBuilder internalized(this);
+          internalized.If<HCompareNumericAndBranch>(not_internalized_bit,
+ graph()->GetConstant0(),
+                                                    Token::EQ);
+          internalized.Then();
           Push(key);
+
+          internalized.Else();
+          Add<HPushArguments>(key);
+          HValue* intern_key = Add<HCallRuntime>(
+              isolate()->factory()->empty_string(),
+              Runtime::FunctionForId(Runtime::kInternalizeString), 1);
+          Push(intern_key);
+
+          internalized.End();
+          // Key guaranteed to be a unique string
         }
         string_index_if.JoinContinuation(join_continuation);
       }
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Fri Jun 27 15:34:18 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Sat Jun 28 00:33:04 2014 UTC
@@ -4453,6 +4453,14 @@

   return *isolate->factory()->NewSubString(string, start, end);
 }
+
+
+RUNTIME_FUNCTION(Runtime_InternalizeString) {
+  HandleScope handles(isolate);
+  RUNTIME_ASSERT(args.length() == 1);
+  CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
+  return *isolate->factory()->InternalizeString(string);
+}


 RUNTIME_FUNCTION(Runtime_StringMatch) {
=======================================
--- /branches/bleeding_edge/src/runtime.h       Fri Jun 27 13:48:37 2014 UTC
+++ /branches/bleeding_edge/src/runtime.h       Sat Jun 28 00:33:04 2014 UTC
@@ -403,6 +403,7 @@
   F(RegExpExecRT, 4, 1) \
   F(StringAdd, 2, 1)  \
   F(SubString, 3, 1) \
+  F(InternalizeString, 1, 1) \
   F(StringCompare, 2, 1) \
   F(StringCharCodeAtRT, 2, 1) \
   F(GetFromCache, 2, 1) \
=======================================
--- /branches/bleeding_edge/tools/generate-runtime-tests.py Fri Jun 27 13:48:37 2014 UTC +++ /branches/bleeding_edge/tools/generate-runtime-tests.py Sat Jun 28 00:33:04 2014 UTC
@@ -47,8 +47,8 @@
# that the parser doesn't bit-rot. Change the values as needed when you add, # remove or change runtime functions, but make sure we don't lose our ability
 # to parse them!
-EXPECTED_FUNCTION_COUNT = 414
-EXPECTED_FUZZABLE_COUNT = 329
+EXPECTED_FUNCTION_COUNT = 415
+EXPECTED_FUZZABLE_COUNT = 330
 EXPECTED_CCTEST_COUNT = 6
 EXPECTED_UNKNOWN_COUNT = 4
 EXPECTED_BUILTINS_COUNT = 806

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