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

Unified Diff: src/code-stubs-hydrogen.cc

Issue 1272763005: [stubs] Store typeof string on Oddballs. (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 | « include/v8.h ('k') | src/factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index b4c74abdd09acfeb38da4567b533491d5573ce52..3fdd5cd51635c04cd35acd01da0bcb002d17d321 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -322,7 +322,6 @@ Handle<Code> NumberToStringStub::GenerateCode() {
// Returns the type string of a value; see ECMA-262, 11.4.3 (p 47).
-// Possible optimizations: put the type string into the oddballs.
template <>
HValue* CodeStubGraphBuilder<TypeofStub>::BuildCodeStub() {
Factory* factory = isolate()->factory();
@@ -341,7 +340,6 @@ HValue* CodeStubGraphBuilder<TypeofStub>::BuildCodeStub() {
{ Push(number_string); }
is_number.Else();
{
- HConstant* undefined_string = Add<HConstant>(factory->undefined_string());
HValue* map = AddLoadMap(object, smi_check);
HValue* instance_type = Add<HLoadNamedField>(
map, nullptr, HObjectAccess::ForMapInstanceType());
@@ -358,24 +356,8 @@ HValue* CodeStubGraphBuilder<TypeofStub>::BuildCodeStub() {
instance_type, Add<HConstant>(ODDBALL_TYPE), Token::EQ);
is_oddball.Then();
{
- IfBuilder is_true_or_false(this);
- is_true_or_false.If<HCompareObjectEqAndBranch>(
- object, graph()->GetConstantTrue());
- is_true_or_false.OrIf<HCompareObjectEqAndBranch>(
- object, graph()->GetConstantFalse());
- is_true_or_false.Then();
- { Push(Add<HConstant>(factory->boolean_string())); }
- is_true_or_false.Else();
- {
- IfBuilder is_null(this);
- is_null.If<HCompareObjectEqAndBranch>(object,
- graph()->GetConstantNull());
- is_null.Then();
- { Push(object_string); }
- is_null.Else();
- { Push(undefined_string); }
- }
- is_true_or_false.End();
+ Push(Add<HLoadNamedField>(object, nullptr,
+ HObjectAccess::ForOddballTypeOf()));
}
is_oddball.Else();
{
@@ -457,7 +439,7 @@ HValue* CodeStubGraphBuilder<TypeofStub>::BuildCodeStub() {
is_undetectable.Then();
{
// typeof an undetectable object is 'undefined'.
- Push(undefined_string);
+ Push(Add<HConstant>(factory->undefined_string()));
}
is_undetectable.Else();
{
« no previous file with comments | « include/v8.h ('k') | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698