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

Unified Diff: src/hydrogen.cc

Issue 79343009: Rework BuildCheckString() to be compatible with the other BuildCheck*() methods. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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/hydrogen.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 9215d0fa27c9ee90adf2490fc64bba067e32264d..2a17f8420dc8fd345f00ecacd7419f9ef8326165 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1273,17 +1273,14 @@ HValue* HGraphBuilder::BuildCheckMap(HValue* obj, Handle<Map> map) {
}
-HValue* HGraphBuilder::BuildCheckString(
- HValue* object, const char* failure_reason) {
- if (!object->type().IsString()) {
- ASSERT(!object->IsConstant() ||
- !HConstant::cast(object)->HasStringValue());
- IfBuilder if_isstring(this);
- if_isstring.If<HIsStringAndBranch>(object);
- if_isstring.Then();
- if_isstring.ElseDeopt(failure_reason);
+HValue* HGraphBuilder::BuildCheckString(HValue* string) {
+ if (!string->type().IsString()) {
+ ASSERT(!string->IsConstant() ||
+ !HConstant::cast(string)->HasStringValue());
+ BuildCheckHeapObject(string);
+ return Add<HCheckInstanceType>(string, HCheckInstanceType::IS_STRING);
}
- return object;
+ return string;
}
@@ -8647,14 +8644,12 @@ HValue* HGraphBuilder::BuildBinaryOperation(
(left_type->Is(Type::String()) || right_type->Is(Type::String()))) {
// Validate type feedback for left argument.
if (left_type->Is(Type::String())) {
- left = BuildCheckString(
- left, "Expected string for LHS of binary operation");
+ left = BuildCheckString(left);
}
// Validate type feedback for right argument.
if (right_type->Is(Type::String())) {
- right = BuildCheckString(
- right, "Expected string for RHS of binary operation");
+ right = BuildCheckString(right);
}
// Convert left argument as necessary.
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698