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

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

Issue 1247783002: Make array allocation stub shared between isolates. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
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 5159 matching lines...) Expand 10 before | Expand all | Expand 10 after
5170 void Function::AttachCode(const Code& value) const { 5170 void Function::AttachCode(const Code& value) const {
5171 SetInstructions(value); 5171 SetInstructions(value);
5172 ASSERT(Function::Handle(value.function()).IsNull() || 5172 ASSERT(Function::Handle(value.function()).IsNull() ||
5173 (value.function() == this->raw())); 5173 (value.function() == this->raw()));
5174 value.set_owner(*this); 5174 value.set_owner(*this);
5175 } 5175 }
5176 5176
5177 5177
5178 bool Function::HasCode() const { 5178 bool Function::HasCode() const {
5179 ASSERT(raw_ptr()->instructions_ != Instructions::null()); 5179 ASSERT(raw_ptr()->instructions_ != Instructions::null());
5180 StubCode* stub_code = Isolate::Current()->stub_code();
5181 return raw_ptr()->instructions_ != 5180 return raw_ptr()->instructions_ !=
5182 stub_code->LazyCompile_entry()->code()->ptr()->instructions_; 5181 StubCode::LazyCompile_entry()->code()->ptr()->instructions_;
5183 } 5182 }
5184 5183
5185 5184
5186 void Function::ClearCode() const { 5185 void Function::ClearCode() const {
5187 ASSERT(ic_data_array() == Array::null()); 5186 ASSERT(ic_data_array() == Array::null());
5188 StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); 5187 StorePointer(&raw_ptr()->unoptimized_code_, Code::null());
5189 StubCode* stub_code = Isolate::Current()->stub_code();
5190 StorePointer(&raw_ptr()->instructions_, 5188 StorePointer(&raw_ptr()->instructions_,
5191 Code::Handle(stub_code->LazyCompile_entry()->code()).instructions()); 5189 Code::Handle(StubCode::LazyCompile_entry()->code()).instructions());
5192 } 5190 }
5193 5191
5194 5192
5195 void Function::SwitchToUnoptimizedCode() const { 5193 void Function::SwitchToUnoptimizedCode() const {
5196 ASSERT(HasOptimizedCode()); 5194 ASSERT(HasOptimizedCode());
5197 Thread* thread = Thread::Current(); 5195 Thread* thread = Thread::Current();
5198 Isolate* isolate = thread->isolate(); 5196 Isolate* isolate = thread->isolate();
5199 Zone* zone = thread->zone(); 5197 Zone* zone = thread->zone();
5200 const Code& current_code = Code::Handle(zone, CurrentCode()); 5198 const Code& current_code = Code::Handle(zone, CurrentCode());
5201 5199
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
6244 result.set_num_optional_parameters(0); 6242 result.set_num_optional_parameters(0);
6245 result.set_usage_counter(0); 6243 result.set_usage_counter(0);
6246 result.set_deoptimization_counter(0); 6244 result.set_deoptimization_counter(0);
6247 result.set_regexp_cid(kIllegalCid); 6245 result.set_regexp_cid(kIllegalCid);
6248 result.set_optimized_instruction_count(0); 6246 result.set_optimized_instruction_count(0);
6249 result.set_optimized_call_site_count(0); 6247 result.set_optimized_call_site_count(0);
6250 result.set_is_optimizable(is_native ? false : true); 6248 result.set_is_optimizable(is_native ? false : true);
6251 result.set_is_inlinable(true); 6249 result.set_is_inlinable(true);
6252 result.set_allows_hoisting_check_class(true); 6250 result.set_allows_hoisting_check_class(true);
6253 result.set_allows_bounds_check_generalization(true); 6251 result.set_allows_bounds_check_generalization(true);
6254 StubCode* stub_code = Isolate::Current()->stub_code(); 6252 result.SetInstructions(Code::Handle(StubCode::LazyCompile_entry()->code()));
6255 result.SetInstructions(Code::Handle(stub_code->LazyCompile_entry()->code()));
6256 if (kind == RawFunction::kClosureFunction) { 6253 if (kind == RawFunction::kClosureFunction) {
6257 const ClosureData& data = ClosureData::Handle(ClosureData::New()); 6254 const ClosureData& data = ClosureData::Handle(ClosureData::New());
6258 result.set_data(data); 6255 result.set_data(data);
6259 } 6256 }
6260 return result.raw(); 6257 return result.raw();
6261 } 6258 }
6262 6259
6263 6260
6264 RawFunction* Function::Clone(const Class& new_owner) const { 6261 RawFunction* Function::Clone(const Class& new_owner) const {
6265 ASSERT(!IsGenerativeConstructor()); 6262 ASSERT(!IsGenerativeConstructor());
(...skipping 14944 matching lines...) Expand 10 before | Expand all | Expand 10 after
21210 return tag_label.ToCString(); 21207 return tag_label.ToCString();
21211 } 21208 }
21212 21209
21213 21210
21214 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21211 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21215 Instance::PrintJSONImpl(stream, ref); 21212 Instance::PrintJSONImpl(stream, ref);
21216 } 21213 }
21217 21214
21218 21215
21219 } // namespace dart 21216 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698