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

Side by Side Diff: runtime/vm/object.cc

Issue 1295823003: VM: Cache instructions entry point in RawFunction/RawCode. (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 unified diff | Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 5182 matching lines...) Expand 10 before | Expand all | Expand 10 after
5193 } 5193 }
5194 5194
5195 5195
5196 bool Function::HasBreakpoint() const { 5196 bool Function::HasBreakpoint() const {
5197 return Isolate::Current()->debugger()->HasBreakpoint(*this); 5197 return Isolate::Current()->debugger()->HasBreakpoint(*this);
5198 } 5198 }
5199 5199
5200 5200
5201 void Function::SetInstructions(const Code& value) const { 5201 void Function::SetInstructions(const Code& value) const {
5202 StorePointer(&raw_ptr()->instructions_, value.instructions()); 5202 StorePointer(&raw_ptr()->instructions_, value.instructions());
5203 StoreNonPointer(&raw_ptr()->entry_point_, value.EntryPoint());
5203 } 5204 }
5204 5205
5205 void Function::AttachCode(const Code& value) const { 5206 void Function::AttachCode(const Code& value) const {
5206 SetInstructions(value); 5207 SetInstructions(value);
5207 ASSERT(Function::Handle(value.function()).IsNull() || 5208 ASSERT(Function::Handle(value.function()).IsNull() ||
5208 (value.function() == this->raw())); 5209 (value.function() == this->raw()));
5209 value.set_owner(*this); 5210 value.set_owner(*this);
5210 } 5211 }
5211 5212
5212 5213
5213 bool Function::HasCode() const { 5214 bool Function::HasCode() const {
5214 ASSERT(raw_ptr()->instructions_ != Instructions::null()); 5215 ASSERT(raw_ptr()->instructions_ != Instructions::null());
5215 return raw_ptr()->instructions_ != 5216 return raw_ptr()->instructions_ !=
5216 StubCode::LazyCompile_entry()->code()->ptr()->instructions_; 5217 StubCode::LazyCompile_entry()->code()->ptr()->instructions_;
5217 } 5218 }
5218 5219
5219 5220
5220 void Function::ClearCode() const { 5221 void Function::ClearCode() const {
5221 ASSERT(ic_data_array() == Array::null()); 5222 ASSERT(ic_data_array() == Array::null());
5222 StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); 5223 StorePointer(&raw_ptr()->unoptimized_code_, Code::null());
5223 StorePointer(&raw_ptr()->instructions_, 5224 SetInstructions(Code::Handle(StubCode::LazyCompile_entry()->code()));
5224 Code::Handle(StubCode::LazyCompile_entry()->code()).instructions());
5225 } 5225 }
5226 5226
5227 5227
5228 void Function::SwitchToUnoptimizedCode() const { 5228 void Function::SwitchToUnoptimizedCode() const {
5229 ASSERT(HasOptimizedCode()); 5229 ASSERT(HasOptimizedCode());
5230 Thread* thread = Thread::Current(); 5230 Thread* thread = Thread::Current();
5231 Isolate* isolate = thread->isolate(); 5231 Isolate* isolate = thread->isolate();
5232 Zone* zone = thread->zone(); 5232 Zone* zone = thread->zone();
5233 const Code& current_code = Code::Handle(zone, CurrentCode()); 5233 const Code& current_code = Code::Handle(zone, CurrentCode());
5234 5234
(...skipping 16152 matching lines...) Expand 10 before | Expand all | Expand 10 after
21387 return tag_label.ToCString(); 21387 return tag_label.ToCString();
21388 } 21388 }
21389 21389
21390 21390
21391 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21391 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21392 Instance::PrintJSONImpl(stream, ref); 21392 Instance::PrintJSONImpl(stream, ref);
21393 } 21393 }
21394 21394
21395 21395
21396 } // namespace dart 21396 } // namespace dart
OLDNEW
« 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