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

Side by Side Diff: src/hydrogen.cc

Issue 176843006: Introduce representation types (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use smi MSB Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 if_objectiskey.If<HCompareObjectEqAndBranch>(object, key); 1668 if_objectiskey.If<HCompareObjectEqAndBranch>(object, key);
1669 if_objectiskey.Then(); 1669 if_objectiskey.Then();
1670 { 1670 {
1671 // Make the key_index available. 1671 // Make the key_index available.
1672 Push(key_index); 1672 Push(key_index);
1673 } 1673 }
1674 if_objectiskey.JoinContinuation(&found); 1674 if_objectiskey.JoinContinuation(&found);
1675 } 1675 }
1676 if_objectissmi.Else(); 1676 if_objectissmi.Else();
1677 { 1677 {
1678 if (type->Is(Type::Smi())) { 1678 if (type->Is(Type::SignedSmall())) {
1679 if_objectissmi.Deopt("Expected smi"); 1679 if_objectissmi.Deopt("Expected smi");
1680 } else { 1680 } else {
1681 // Check if the object is a heap number. 1681 // Check if the object is a heap number.
1682 IfBuilder if_objectisnumber(this); 1682 IfBuilder if_objectisnumber(this);
1683 HValue* objectisnumber = if_objectisnumber.If<HCompareMap>( 1683 HValue* objectisnumber = if_objectisnumber.If<HCompareMap>(
1684 object, isolate()->factory()->heap_number_map()); 1684 object, isolate()->factory()->heap_number_map());
1685 if_objectisnumber.Then(); 1685 if_objectisnumber.Then();
1686 { 1686 {
1687 // Compute hash for heap number similar to double_get_hash(). 1687 // Compute hash for heap number similar to double_get_hash().
1688 HValue* low = Add<HLoadNamedField>( 1688 HValue* low = Add<HLoadNamedField>(
(...skipping 7317 matching lines...) Expand 10 before | Expand all | Expand 10 after
9006 (right_const->Integer32Value() & 0x1f) != 0) { 9006 (right_const->Integer32Value() & 0x1f) != 0) {
9007 return false; 9007 return false;
9008 } 9008 }
9009 } 9009 }
9010 return true; 9010 return true;
9011 } 9011 }
9012 9012
9013 9013
9014 HValue* HGraphBuilder::EnforceNumberType(HValue* number, 9014 HValue* HGraphBuilder::EnforceNumberType(HValue* number,
9015 Type* expected) { 9015 Type* expected) {
9016 if (expected->Is(Type::Smi())) { 9016 if (expected->Is(Type::SignedSmall())) {
9017 return AddUncasted<HForceRepresentation>(number, Representation::Smi()); 9017 return AddUncasted<HForceRepresentation>(number, Representation::Smi());
9018 } 9018 }
9019 if (expected->Is(Type::Signed32())) { 9019 if (expected->Is(Type::Signed32())) {
9020 return AddUncasted<HForceRepresentation>(number, 9020 return AddUncasted<HForceRepresentation>(number,
9021 Representation::Integer32()); 9021 Representation::Integer32());
9022 } 9022 }
9023 return number; 9023 return number;
9024 } 9024 }
9025 9025
9026 9026
(...skipping 22 matching lines...) Expand all
9049 9049
9050 // We expect to get a number. 9050 // We expect to get a number.
9051 // (We need to check first, since Type::None->Is(Type::Any()) == true. 9051 // (We need to check first, since Type::None->Is(Type::Any()) == true.
9052 if (expected_obj->Is(Type::None())) { 9052 if (expected_obj->Is(Type::None())) {
9053 ASSERT(!expected_number->Is(Type::None(zone()))); 9053 ASSERT(!expected_number->Is(Type::None(zone())));
9054 return value; 9054 return value;
9055 } 9055 }
9056 9056
9057 if (expected_obj->Is(Type::Undefined(zone()))) { 9057 if (expected_obj->Is(Type::Undefined(zone()))) {
9058 // This is already done by HChange. 9058 // This is already done by HChange.
9059 *expected = Type::Union(expected_number, Type::Double(zone()), zone()); 9059 *expected = Type::Union(expected_number, Type::Float(zone()), zone());
9060 return value; 9060 return value;
9061 } 9061 }
9062 9062
9063 return value; 9063 return value;
9064 } 9064 }
9065 9065
9066 9066
9067 HValue* HOptimizedGraphBuilder::BuildBinaryOperation( 9067 HValue* HOptimizedGraphBuilder::BuildBinaryOperation(
9068 BinaryOperation* expr, 9068 BinaryOperation* expr,
9069 HValue* left, 9069 HValue* left,
(...skipping 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after
11298 if (ShouldProduceTraceOutput()) { 11298 if (ShouldProduceTraceOutput()) {
11299 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11299 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11300 } 11300 }
11301 11301
11302 #ifdef DEBUG 11302 #ifdef DEBUG
11303 graph_->Verify(false); // No full verify. 11303 graph_->Verify(false); // No full verify.
11304 #endif 11304 #endif
11305 } 11305 }
11306 11306
11307 } } // namespace v8::internal 11307 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/ic.cc » ('j') | src/types.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698