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

Unified Diff: src/hydrogen-instructions.cc

Issue 12049012: Avoid handle dereference during graph optimization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index fc6c3c599a80b06e004d0ec60aff0212f005d587..84dcde81a9942a90ef6ff067b613a3a1ed676f4c 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -342,6 +342,8 @@ const char* HType::ToString() {
HType HType::TypeFromValue(Handle<Object> value) {
+ AllowHandleDereference allow_handle_deref;
+
HType result = HType::Tagged();
if (value->IsSmi()) {
result = HType::Smi();
@@ -1119,10 +1121,10 @@ HValue* HCheckInstanceType::Canonicalize() {
value()->type().IsString()) {
return NULL;
}
- if (check_ == IS_SYMBOL &&
- value()->IsConstant() &&
- HConstant::cast(value())->handle()->IsSymbol()) {
- return NULL;
+
+ if (check_ == IS_SYMBOL && value()->IsConstant()) {
+ AllowHandleDereference allow_handle_deref;
+ if (HConstant::cast(value())->handle()->IsSymbol()) return NULL;
}
return this;
}
@@ -1555,6 +1557,7 @@ HConstant::HConstant(Handle<Object> handle, Representation r)
: handle_(handle),
has_int32_value_(false),
has_double_value_(false) {
+ AllowHandleDereference allow_handle_deref;
SetFlag(kUseGVN);
if (handle_->IsNumber()) {
double n = handle_->Number();
@@ -1633,12 +1636,12 @@ bool HConstant::ToBoolean() {
double v = DoubleValue();
return v != 0 && !isnan(v);
}
- Handle<Object> literal = handle();
- if (literal->IsTrue()) return true;
- if (literal->IsFalse()) return false;
- if (literal->IsUndefined()) return false;
- if (literal->IsNull()) return false;
- if (literal->IsString() && String::cast(*literal)->length() == 0) {
+ AllowHandleDereference allow_handle_deref;
+ if (handle_->IsTrue()) return true;
+ if (handle_->IsFalse()) return false;
+ if (handle_->IsUndefined()) return false;
+ if (handle_->IsNull()) return false;
+ if (handle_->IsString() && String::cast(*handle_)->length() == 0) {
return false;
}
return true;

Powered by Google App Engine
This is Rietveld 408576698