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

Unified Diff: runtime/vm/object.cc

Issue 1295973002: Store the RegExp and the string specialization cid in an Array in RawFunction::data_. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 25a060ae1604ef31da84166c6884e36f7fc17569..c58c377767b8130745f229166ac19a6a35065749 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -5559,24 +5559,27 @@ void Function::set_owner(const Object& value) const {
RawJSRegExp* Function::regexp() const {
ASSERT(kind() == RawFunction::kIrregexpFunction);
- const Object& obj = Object::Handle(raw_ptr()->data_);
- return JSRegExp::Cast(obj).raw();
+ const Array& pair = Array::Cast(Object::Handle(raw_ptr()->data_));
+ return JSRegExp::RawCast(pair.At(0));
}
-void Function::set_regexp(const JSRegExp& value) const {
+intptr_t Function::string_specialization_cid() const {
ASSERT(kind() == RawFunction::kIrregexpFunction);
- ASSERT(raw_ptr()->data_ == Object::null());
- set_data(value);
+ const Array& pair = Array::Cast(Object::Handle(raw_ptr()->data_));
+ return Smi::Value(Smi::RawCast(pair.At(1)));
}
-void Function::set_regexp_cid(intptr_t regexp_cid) const {
- ASSERT((regexp_cid == kIllegalCid) ||
- (kind() == RawFunction::kIrregexpFunction));
- ASSERT((regexp_cid == kIllegalCid) ||
- RawObject::IsStringClassId(regexp_cid));
- StoreNonPointer(&raw_ptr()->regexp_cid_, regexp_cid);
+void Function::SetRegExpData(const JSRegExp& regexp,
+ intptr_t string_specialization_cid) const {
+ ASSERT(kind() == RawFunction::kIrregexpFunction);
+ ASSERT(RawObject::IsStringClassId(string_specialization_cid));
+ ASSERT(raw_ptr()->data_ == Object::null());
+ const Array& pair = Array::Handle(Array::New(2, Heap::kOld));
+ pair.SetAt(0, regexp);
+ pair.SetAt(1, Smi::Handle(Smi::New(string_specialization_cid)));
+ set_data(pair);
}
@@ -6279,7 +6282,6 @@ RawFunction* Function::New(const String& name,
result.set_num_optional_parameters(0);
result.set_usage_counter(0);
result.set_deoptimization_counter(0);
- result.set_regexp_cid(kIllegalCid);
result.set_optimized_instruction_count(0);
result.set_optimized_call_site_count(0);
result.set_is_optimizable(is_native ? false : true);
@@ -6307,7 +6309,6 @@ RawFunction* Function::Clone(const Class& new_owner) const {
clone.ClearCode();
clone.set_usage_counter(0);
clone.set_deoptimization_counter(0);
- clone.set_regexp_cid(kIllegalCid);
clone.set_optimized_instruction_count(0);
clone.set_optimized_call_site_count(0);
if (new_owner.NumTypeParameters() > 0) {
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698