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

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

Issue 9475031: Cleaned up usage of Function::code, since it may be misunderstood that it points to the only Code o… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
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 "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 3558 matching lines...) Expand 10 before | Expand all | Expand 10 after
3569 for (intptr_t i = 0; i < num_parameters; i++) { 3569 for (intptr_t i = 0; i < num_parameters; i++) {
3570 type = ParameterTypeAt(i); 3570 type = ParameterTypeAt(i);
3571 if (!type.IsInstantiated()) { 3571 if (!type.IsInstantiated()) {
3572 return false; 3572 return false;
3573 } 3573 }
3574 } 3574 }
3575 return true; 3575 return true;
3576 } 3576 }
3577 3577
3578 3578
3579 bool Function::HasOptimizedCode() const {
3580 return HasCode() && Code::Handle(code()).is_optimized();
3581 }
3582
3583
3579 const char* Function::ToCString() const { 3584 const char* Function::ToCString() const {
3580 const char* f0 = is_static() ? " static" : ""; 3585 const char* f0 = is_static() ? " static" : "";
3581 const char* f1 = NULL; 3586 const char* f1 = NULL;
3582 const char* f2 = is_const() ? " const" : ""; 3587 const char* f2 = is_const() ? " const" : "";
3583 switch (kind()) { 3588 switch (kind()) {
3584 case RawFunction::kFunction: 3589 case RawFunction::kFunction:
3585 case RawFunction::kClosureFunction: 3590 case RawFunction::kClosureFunction:
3586 case RawFunction::kGetterFunction: 3591 case RawFunction::kGetterFunction:
3587 case RawFunction::kSetterFunction: 3592 case RawFunction::kSetterFunction:
3588 f1 = ""; 3593 f1 = "";
(...skipping 4376 matching lines...) Expand 10 before | Expand all | Expand 10 after
7965 ASSERT(Isolate::Current() != NULL); 7970 ASSERT(Isolate::Current() != NULL);
7966 CodeIndexTable* code_index_table = Isolate::Current()->code_index_table(); 7971 CodeIndexTable* code_index_table = Isolate::Current()->code_index_table();
7967 ASSERT(code_index_table != NULL); 7972 ASSERT(code_index_table != NULL);
7968 Function& function = Function::Handle(); 7973 Function& function = Function::Handle();
7969 Code& code = Code::Handle(); 7974 Code& code = Code::Handle();
7970 Smi& pc_offset = Smi::Handle(); 7975 Smi& pc_offset = Smi::Handle();
7971 const Array& function_array = Array::Handle(raw_ptr()->function_array_); 7976 const Array& function_array = Array::Handle(raw_ptr()->function_array_);
7972 const Array& code_array = Array::Handle(raw_ptr()->code_array_); 7977 const Array& code_array = Array::Handle(raw_ptr()->code_array_);
7973 const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); 7978 const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_);
7974 for (intptr_t i = 0; i < frame_pcs.length(); i++) { 7979 for (intptr_t i = 0; i < frame_pcs.length(); i++) {
7975 function = code_index_table->LookupFunction(frame_pcs[i]); 7980 code = code_index_table->LookupCode(frame_pcs[i]);
7981 ASSERT(!code.IsNull());
7982 function = code.function();
7976 function_array.SetAt((index + i), function); 7983 function_array.SetAt((index + i), function);
7977 code = function.code();
7978 code_array.SetAt((index + i), code); 7984 code_array.SetAt((index + i), code);
7979 pc_offset = Smi::New(frame_pcs[i] - code.EntryPoint()); 7985 pc_offset = Smi::New(frame_pcs[i] - code.EntryPoint());
7980 pc_offset_array.SetAt((index + i), pc_offset); 7986 pc_offset_array.SetAt((index + i), pc_offset);
7981 } 7987 }
7982 } 7988 }
7983 7989
7984 7990
7985 RawStacktrace* Stacktrace::New(const GrowableArray<uword>& stack_frame_pcs, 7991 RawStacktrace* Stacktrace::New(const GrowableArray<uword>& stack_frame_pcs,
7986 Heap::Space space) { 7992 Heap::Space space) {
7987 const Class& cls = Class::Handle( 7993 const Class& cls = Class::Handle(
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
8302 result.set_num_args_tested(num_args_tested); 8308 result.set_num_args_tested(num_args_tested);
8303 // Number of array elements in one test entry (num_args_tested + 1) 8309 // Number of array elements in one test entry (num_args_tested + 1)
8304 intptr_t len = num_args_tested + 1; 8310 intptr_t len = num_args_tested + 1;
8305 // IC data array must be null terminated (sentinel entry). 8311 // IC data array must be null terminated (sentinel entry).
8306 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); 8312 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld));
8307 result.set_ic_data(ic_data); 8313 result.set_ic_data(ic_data);
8308 return result.raw(); 8314 return result.raw();
8309 } 8315 }
8310 8316
8311 } // namespace dart 8317 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698