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

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

Issue 2195863002: [turbofan] Stub for typeof operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Delete now unused untemplated DoUnaryOp Created 4 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 | « src/code-stubs.cc ('k') | src/crankshaft/arm/lithium-codegen-arm.cc » ('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 76f1cbf5d1892808e8ba23f69e13c7cf6b3566f6..65bf423ea200c1fea83444ecd65ccd3adaf11364 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -343,114 +343,6 @@ Handle<Code> NumberToStringStub::GenerateCode() {
}
-// Returns the type string of a value; see ECMA-262, 11.4.3 (p 47).
-template <>
-HValue* CodeStubGraphBuilder<TypeofStub>::BuildCodeStub() {
- Factory* factory = isolate()->factory();
- HConstant* number_string = Add<HConstant>(factory->number_string());
- HValue* object = GetParameter(Descriptor::kObject);
-
- IfBuilder is_smi(this);
- HValue* smi_check = is_smi.If<HIsSmiAndBranch>(object);
- is_smi.Then();
- { Push(number_string); }
- is_smi.Else();
- {
- IfBuilder is_number(this);
- is_number.If<HCompareMap>(object, isolate()->factory()->heap_number_map());
- is_number.Then();
- { Push(number_string); }
- is_number.Else();
- {
- HValue* map = AddLoadMap(object, smi_check);
- HValue* instance_type = Add<HLoadNamedField>(
- map, nullptr, HObjectAccess::ForMapInstanceType());
- IfBuilder is_string(this);
- is_string.If<HCompareNumericAndBranch>(
- instance_type, Add<HConstant>(FIRST_NONSTRING_TYPE), Token::LT);
- is_string.Then();
- { Push(Add<HConstant>(factory->string_string())); }
- is_string.Else();
- {
- HConstant* object_string = Add<HConstant>(factory->object_string());
- IfBuilder is_oddball(this);
- is_oddball.If<HCompareNumericAndBranch>(
- instance_type, Add<HConstant>(ODDBALL_TYPE), Token::EQ);
- is_oddball.Then();
- {
- Push(Add<HLoadNamedField>(object, nullptr,
- HObjectAccess::ForOddballTypeOf()));
- }
- is_oddball.Else();
- {
- IfBuilder is_symbol(this);
- is_symbol.If<HCompareNumericAndBranch>(
- instance_type, Add<HConstant>(SYMBOL_TYPE), Token::EQ);
- is_symbol.Then();
- { Push(Add<HConstant>(factory->symbol_string())); }
- is_symbol.Else();
- {
- HValue* bit_field = Add<HLoadNamedField>(
- map, nullptr, HObjectAccess::ForMapBitField());
- HValue* bit_field_masked = AddUncasted<HBitwise>(
- Token::BIT_AND, bit_field,
- Add<HConstant>((1 << Map::kIsCallable) |
- (1 << Map::kIsUndetectable)));
- IfBuilder is_function(this);
- is_function.If<HCompareNumericAndBranch>(
- bit_field_masked, Add<HConstant>(1 << Map::kIsCallable),
- Token::EQ);
- is_function.Then();
- { Push(Add<HConstant>(factory->function_string())); }
- is_function.Else();
- {
-#define SIMD128_BUILDER_OPEN(TYPE, Type, type, lane_count, lane_type) \
- IfBuilder is_##type(this); \
- is_##type.If<HCompareObjectEqAndBranch>( \
- map, Add<HConstant>(factory->type##_map())); \
- is_##type.Then(); \
- { Push(Add<HConstant>(factory->type##_string())); } \
- is_##type.Else(); {
- SIMD128_TYPES(SIMD128_BUILDER_OPEN)
-#undef SIMD128_BUILDER_OPEN
- // Is it an undetectable object?
- IfBuilder is_undetectable(this);
- is_undetectable.If<HCompareNumericAndBranch>(
- bit_field_masked, graph()->GetConstant0(), Token::NE);
- is_undetectable.Then();
- {
- // typeof an undetectable object is 'undefined'.
- Push(Add<HConstant>(factory->undefined_string()));
- }
- is_undetectable.Else();
- {
- // For any kind of object not handled above, the spec rule for
- // host objects gives that it is okay to return "object".
- Push(object_string);
- }
-#define SIMD128_BUILDER_CLOSE(TYPE, Type, type, lane_count, lane_type) }
- SIMD128_TYPES(SIMD128_BUILDER_CLOSE)
-#undef SIMD128_BUILDER_CLOSE
- }
- is_function.End();
- }
- is_symbol.End();
- }
- is_oddball.End();
- }
- is_string.End();
- }
- is_number.End();
- }
- is_smi.End();
-
- return environment()->Pop();
-}
-
-
-Handle<Code> TypeofStub::GenerateCode() { return DoGenerateCode(this); }
-
-
template <>
HValue* CodeStubGraphBuilder<FastCloneRegExpStub>::BuildCodeStub() {
HValue* closure = GetParameter(Descriptor::kClosure);
« no previous file with comments | « src/code-stubs.cc ('k') | src/crankshaft/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698