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

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 & added MIPS code 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
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 34118)
+++ runtime/vm/object.cc (working copy)
@@ -683,7 +683,7 @@
PcDescriptors::initializeHandle(
empty_descriptors_,
reinterpret_cast<RawPcDescriptors*>(address + kHeapObjectTag));
- empty_descriptors_->raw_ptr()->length_ = Smi::New(0);
+ empty_descriptors_->raw_ptr()->length_ = 0;
}
@@ -4601,16 +4601,29 @@
}
-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 {
+ return raw_ptr()->code_ != Code::null()
+ && raw_ptr()->code_ != StubCode::LazyCompileClosure_entry()->code();
+}
+
+
void Function::ClearCode() const {
- StorePointer(&raw_ptr()->code_, Code::null());
+ StorePointer(&raw_ptr()->code_,
+ IsClosureFunction()
+ ? StubCode::LazyCompileClosure_entry()->code()
+ : Code::null());
StorePointer(&raw_ptr()->unoptimized_code_, Code::null());
}
@@ -4637,7 +4650,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()));
}
@@ -5679,6 +5692,8 @@
parent_owner,
token_pos));
result.set_parent_function(parent);
+ result.set_code(Code::Handle(StubCode::LazyCompileClosure_entry()->code()));
+
return result.raw();
}
@@ -9364,14 +9379,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;
}
@@ -9573,11 +9586,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') | runtime/vm/raw_object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698