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

Unified Diff: runtime/vm/object.cc

Issue 203523011: Introduce a lazy-compile stub for functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: rebased 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 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
===================================================================
--- runtime/vm/object.cc (revision 34642)
+++ runtime/vm/object.cc (working copy)
@@ -667,7 +667,7 @@
PcDescriptors::initializeHandle(
empty_descriptors_,
reinterpret_cast<RawPcDescriptors*>(address + kHeapObjectTag));
- empty_descriptors_->raw_ptr()->length_ = Smi::New(0);
+ empty_descriptors_->raw_ptr()->length_ = 0;
}
@@ -4800,16 +4800,26 @@
}
-void Function::SetCode(const Code& value) const {
+void Function::set_code(const Code& value) const {
StorePointer(&raw_ptr()->code_, value.raw());
+}
+
+void Function::AttachCode(const Code& value) const {
+ set_code(value);
ASSERT(Function::Handle(value.function()).IsNull() ||
(value.function() == this->raw()));
value.set_owner(*this);
}
+bool Function::HasCode() const {
+ ASSERT(raw_ptr()->code_ != Code::null());
+ return raw_ptr()->code_ != StubCode::LazyCompile_entry()->code();
+}
+
+
void Function::ClearCode() const {
- StorePointer(&raw_ptr()->code_, Code::null());
+ StorePointer(&raw_ptr()->code_, StubCode::LazyCompile_entry()->code());
StorePointer(&raw_ptr()->unoptimized_code_, Code::null());
}
@@ -4836,7 +4846,7 @@
// Patch entry of the optimized code.
CodePatcher::PatchEntry(current_code);
// Use previously compiled unoptimized code.
- SetCode(Code::Handle(unoptimized_code()));
+ AttachCode(Code::Handle(unoptimized_code()));
CodePatcher::RestoreEntry(Code::Handle(unoptimized_code()));
}
@@ -5853,6 +5863,7 @@
const ClosureData& data = ClosureData::Handle(ClosureData::New());
result.set_data(data);
}
+ result.set_code(Code::Handle(StubCode::LazyCompile_entry()->code()));
return result.raw();
}
@@ -5865,8 +5876,7 @@
const PatchClass& clone_owner =
PatchClass::Handle(PatchClass::New(new_owner, origin));
clone.set_owner(clone_owner);
- clone.StorePointer(&clone.raw_ptr()->code_, Code::null());
- clone.StorePointer(&clone.raw_ptr()->unoptimized_code_, Code::null());
+ clone.ClearCode();
clone.set_usage_counter(0);
clone.set_deoptimization_counter(0);
clone.set_optimized_instruction_count(0);
@@ -5893,6 +5903,7 @@
parent_owner,
token_pos));
result.set_parent_function(parent);
+
return result.raw();
}
@@ -9798,14 +9809,12 @@
intptr_t PcDescriptors::Length() const {
- return Smi::Value(raw_ptr()->length_);
+ return raw_ptr()->length_;
}
void PcDescriptors::SetLength(intptr_t value) const {
- // This is only safe because we create a new Smi, which does not cause
- // heap allocation.
- raw_ptr()->length_ = Smi::New(value);
+ raw_ptr()->length_ = value;
}
@@ -10007,11 +10016,6 @@
}
-void Stackmap::SetCode(const dart::Code& code) const {
- StorePointer(&raw_ptr()->code_, code.raw());
-}
-
-
bool Stackmap::GetBit(intptr_t bit_index) const {
ASSERT(InRange(bit_index));
int byte_index = bit_index >> kBitsPerByteLog2;
« 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