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

Unified Diff: src/hydrogen-instructions.h

Issue 12832002: Parallel recompilation: fewer handle dereferences and tighter checks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 823fea942ecf5ed8e8294e7ebd02e4320efef06c..57703bde52bd9b8bb4536cafd38f83e2cdd9d220 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -394,7 +394,7 @@ class HType {
return Combine(other).Equals(other);
}
- bool IsTagged() {
+ bool IsTagged() const {
ASSERT(type_ != kUninitialized);
return ((type_ & kTagged) == kTagged);
}
@@ -404,56 +404,56 @@ class HType {
return ((type_ & kTaggedPrimitive) == kTaggedPrimitive);
}
- bool IsTaggedNumber() {
+ bool IsTaggedNumber() const {
ASSERT(type_ != kUninitialized);
return ((type_ & kTaggedNumber) == kTaggedNumber);
}
- bool IsSmi() {
+ bool IsSmi() const {
ASSERT(type_ != kUninitialized);
return ((type_ & kSmi) == kSmi);
}
- bool IsHeapNumber() {
+ bool IsHeapNumber() const {
ASSERT(type_ != kUninitialized);
return ((type_ & kHeapNumber) == kHeapNumber);
}
- bool IsString() {
+ bool IsString() const {
ASSERT(type_ != kUninitialized);
return ((type_ & kString) == kString);
}
- bool IsBoolean() {
+ bool IsBoolean() const {
ASSERT(type_ != kUninitialized);
return ((type_ & kBoolean) == kBoolean);
}
- bool IsNonPrimitive() {
+ bool IsNonPrimitive() const {
ASSERT(type_ != kUninitialized);
return ((type_ & kNonPrimitive) == kNonPrimitive);
}
- bool IsJSArray() {
+ bool IsJSArray() const {
ASSERT(type_ != kUninitialized);
return ((type_ & kJSArray) == kJSArray);
}
- bool IsJSObject() {
+ bool IsJSObject() const {
ASSERT(type_ != kUninitialized);
return ((type_ & kJSObject) == kJSObject);
}
- bool IsUninitialized() {
+ bool IsUninitialized() const {
return type_ == kUninitialized;
}
- bool IsHeapObject() {
+ bool IsHeapObject() const {
ASSERT(type_ != kUninitialized);
return IsHeapNumber() || IsString() || IsNonPrimitive();
}
- static HType TypeFromValue(Isolate* isolate, Handle<Object> value);
+ static HType TypeFromValue(Handle<Object> value);
const char* ToString();
@@ -2792,7 +2792,10 @@ class HCheckPrototypeMaps: public HTemplateInstruction<0> {
virtual intptr_t Hashcode() {
ASSERT_ALLOCATION_DISABLED;
// Dereferencing to use the object's raw address for hashing is safe.
- AllowHandleDereference allow_handle_deref(isolate());
+ HandleDereferenceGuard allow_handle_deref(isolate(),
+ HandleDereferenceGuard::ALLOW);
+ SLOW_ASSERT(Heap::RelocationLock::IsLocked(isolate()->heap()) ||
+ !isolate()->optimizing_compiler_thread()->IsOptimizerThread());
intptr_t hash = 0;
for (int i = 0; i < prototypes_.length(); i++) {
hash = 17 * hash + reinterpret_cast<intptr_t>(*prototypes_[i]);
@@ -3070,8 +3073,17 @@ class HArgumentsObject: public HTemplateInstruction<0> {
class HConstant: public HTemplateInstruction<0> {
public:
HConstant(Handle<Object> handle, Representation r);
- HConstant(int32_t value, Representation r);
- HConstant(double value, Representation r);
+ HConstant(int32_t value,
+ Representation r,
+ Handle<Object> optional_handle = Handle<Object>::null());
+ HConstant(double value,
+ Representation r,
+ Handle<Object> optional_handle = Handle<Object>::null());
+ HConstant(Handle<Object> handle,
+ Representation r,
+ HType type,
+ bool is_internalized_string,
+ bool boolean_value);
Handle<Object> handle() {
if (handle_.is_null()) {
@@ -3099,8 +3111,9 @@ class HConstant: public HTemplateInstruction<0> {
Heap* heap = isolate()->heap();
// We should have handled minus_zero_value and nan_value in the
// has_double_value_ clause above.
- // Dereferencing is safe to compare against singletons.
- AllowHandleDereference allow_handle_deref(isolate());
+ // Dereferencing is safe to compare against immovable singletons.
+ HandleDereferenceGuard allow_handle_deref(isolate(),
+ HandleDereferenceGuard::ALLOW);
ASSERT(*handle_ != heap->minus_zero_value());
ASSERT(*handle_ != heap->nan_value());
return *handle_ == heap->undefined_value() ||
@@ -3149,14 +3162,17 @@ class HConstant: public HTemplateInstruction<0> {
bool HasStringValue() const {
if (has_double_value_ || has_int32_value_) return false;
ASSERT(!handle_.is_null());
- return handle_->IsString();
+ return type_from_value_.IsString();
}
Handle<String> StringValue() const {
ASSERT(HasStringValue());
return Handle<String>::cast(handle_);
}
+ bool HasInternalizedStringValue() const {
+ return HasStringValue() && is_internalized_string_;
+ }
- bool ToBoolean();
+ bool BooleanValue() { return boolean_value_; }
Jakob Kummerow 2013/03/13 15:50:31 nit: boolean_value()
Yang 2013/03/13 17:00:15 I thought camel case was more appropriate since St
bool IsUint32() {
return HasInteger32Value() && (Integer32Value() >= 0);
@@ -3173,7 +3189,10 @@ class HConstant: public HTemplateInstruction<0> {
} else {
ASSERT(!handle_.is_null());
// Dereferencing to use the object's raw address for hashing is safe.
- AllowHandleDereference allow_handle_deref(isolate());
+ HandleDereferenceGuard allow_handle_deref(isolate(),
+ HandleDereferenceGuard::ALLOW);
+ SLOW_ASSERT(Heap::RelocationLock::IsLocked(isolate()->heap()) ||
+ !isolate()->optimizing_compiler_thread()->IsOptimizerThread());
hash = reinterpret_cast<intptr_t>(*handle_);
}
@@ -3225,6 +3244,10 @@ class HConstant: public HTemplateInstruction<0> {
bool has_double_value_ : 1;
int32_t int32_value_;
double double_value_;
+ HType type_from_value_;
+ bool is_internalized_string_; // TODO(yangguo) make this part of HType
Jakob Kummerow 2013/03/13 15:50:31 Please move this up to the other has_$FOO_value_ p
Yang 2013/03/13 17:00:15 Done.
+ bool boolean_value_;
Jakob Kummerow 2013/03/13 15:50:31 Please move this up to the other $FOO_value_ prope
Yang 2013/03/13 17:00:15 Done.
+ intptr_t handle_hash_;
};
@@ -4526,7 +4549,10 @@ class HLoadGlobalCell: public HTemplateInstruction<0> {
virtual intptr_t Hashcode() {
ASSERT_ALLOCATION_DISABLED;
// Dereferencing to use the object's raw address for hashing is safe.
- AllowHandleDereference allow_handle_deref(isolate());
+ HandleDereferenceGuard allow_handle_deref(isolate(),
+ HandleDereferenceGuard::ALLOW);
+ SLOW_ASSERT(Heap::RelocationLock::IsLocked(isolate()->heap()) ||
+ !isolate()->optimizing_compiler_thread()->IsOptimizerThread());
return reinterpret_cast<intptr_t>(*cell_);
}

Powered by Google App Engine
This is Rietveld 408576698