Commit 9176485c authored by danno@chromium.org's avatar danno@chromium.org

Support non-internalized string key lookups in Hydrogen KeyedLoadIC

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/356213003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22070 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 134e5014
......@@ -1513,13 +1513,23 @@ void HGraphBuilder::BuildKeyedIndexCheck(HValue* key,
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);
}
......
......@@ -4455,6 +4455,14 @@ RUNTIME_FUNCTION(Runtime_SubString) {
}
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) {
HandleScope handles(isolate);
ASSERT(args.length() == 3);
......
......@@ -403,6 +403,7 @@ namespace internal {
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) \
......
// 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);
......@@ -47,8 +47,8 @@ EXPAND_MACROS = [
# 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment