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

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

Issue 11418046: First part of static call cleanup: store static call targets into code object, referenced by code-o… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« 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/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 6989 matching lines...) Expand 10 before | Expand all | Expand 10 after
7000 void Code::set_deopt_info_array(const Array& array) const { 7000 void Code::set_deopt_info_array(const Array& array) const {
7001 StorePointer(&raw_ptr()->deopt_info_array_, array.raw()); 7001 StorePointer(&raw_ptr()->deopt_info_array_, array.raw());
7002 } 7002 }
7003 7003
7004 7004
7005 void Code::set_object_table(const Array& array) const { 7005 void Code::set_object_table(const Array& array) const {
7006 StorePointer(&raw_ptr()->object_table_, array.raw()); 7006 StorePointer(&raw_ptr()->object_table_, array.raw());
7007 } 7007 }
7008 7008
7009 7009
7010 void Code::set_resolved_static_calls(const GrowableObjectArray& val) const { 7010 void Code::set_static_calls_target_table(const Array& value) const {
7011 StorePointer(&raw_ptr()->resolved_static_calls_, val.raw()); 7011 StorePointer(&raw_ptr()->static_calls_target_table_, value.raw());
7012 }
7013
7014
7015 RawFunction* Code::GetStaticCallTargetFunctionAt(uword pc) const {
7016 RawObject* raw_code_offset =
7017 reinterpret_cast<RawObject*>(Smi::New(pc - EntryPoint()));
7018 const Array& array =
7019 Array::Handle(raw_ptr()->static_calls_target_table_);
7020 for (intptr_t i = 0; i < array.Length(); i += kSCallTableEntryLength) {
7021 if (array.At(i) == raw_code_offset) {
7022 Function& function = Function::Handle();
7023 function ^= array.At(i + kSCallTableFunctionEntry);
7024 return function.raw();
7025 }
7026 }
7027 return Function::null();
7028 }
7029
7030
7031 void Code::SetStaticCallTargetCodeAt(uword pc, const Code& code) const {
7032 RawObject* raw_code_offset =
7033 reinterpret_cast<RawObject*>(Smi::New(pc - EntryPoint()));
7034 const Array& array =
7035 Array::Handle(raw_ptr()->static_calls_target_table_);
7036 for (intptr_t i = 0; i < array.Length(); i += kSCallTableEntryLength) {
7037 if (array.At(i) == raw_code_offset) {
7038 ASSERT(code.IsNull() ||
7039 (code.function() == array.At(i + kSCallTableFunctionEntry)));
7040 array.SetAt(i + kSCallTableCodeEntry, code);
7041 return;
7042 }
7043 }
7044 UNREACHABLE();
7012 } 7045 }
7013 7046
7014 7047
7015 const Code::Comments& Code::comments() const { 7048 const Code::Comments& Code::comments() const {
7016 Comments* comments = new Code::Comments(raw_ptr()->comments_); 7049 Comments* comments = new Code::Comments(raw_ptr()->comments_);
7017 return *comments; 7050 return *comments;
7018 } 7051 }
7019 7052
7020 7053
7021 void Code::set_comments(const Code::Comments& comments) const { 7054 void Code::set_comments(const Code::Comments& comments) const {
(...skipping 5069 matching lines...) Expand 10 before | Expand all | Expand 10 after
12091 } 12124 }
12092 return result.raw(); 12125 return result.raw();
12093 } 12126 }
12094 12127
12095 12128
12096 const char* WeakProperty::ToCString() const { 12129 const char* WeakProperty::ToCString() const {
12097 return "_WeakProperty"; 12130 return "_WeakProperty";
12098 } 12131 }
12099 12132
12100 } // namespace dart 12133 } // 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