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

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

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 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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 void set_parameter_types(const Array& value) const; 1484 void set_parameter_types(const Array& value) const;
1485 1485
1486 // Parameter names are valid for all valid parameter indices, and are not 1486 // Parameter names are valid for all valid parameter indices, and are not
1487 // limited to named optional parameters. 1487 // limited to named optional parameters.
1488 RawString* ParameterNameAt(intptr_t index) const; 1488 RawString* ParameterNameAt(intptr_t index) const;
1489 void SetParameterNameAt(intptr_t index, const String& value) const; 1489 void SetParameterNameAt(intptr_t index, const String& value) const;
1490 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; } 1490 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; }
1491 void set_parameter_names(const Array& value) const; 1491 void set_parameter_names(const Array& value) const;
1492 1492
1493 // Sets function's code and code's function. 1493 // Sets function's code and code's function.
1494 void SetCode(const Code& value) const; 1494 void AttachCode(const Code& value) const;
1495 void ClearCode() const; 1495 void set_code(const Code& value) const;
1496 void ClearCode() const;
1496 1497
1497 // Disables optimized code and switches to unoptimized code. 1498 // Disables optimized code and switches to unoptimized code.
1498 void SwitchToUnoptimizedCode() const; 1499 void SwitchToUnoptimizedCode() const;
1499 1500
1500 // Return the most recently compiled and installed code for this function. 1501 // Return the most recently compiled and installed code for this function.
1501 // It is not the only Code object that points to this function. 1502 // It is not the only Code object that points to this function.
1502 RawCode* CurrentCode() const { return raw_ptr()->code_; } 1503 RawCode* CurrentCode() const { return raw_ptr()->code_; }
1503 1504
1504 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } 1505 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; }
1505 void set_unoptimized_code(const Code& value) const; 1506 void set_unoptimized_code(const Code& value) const;
1506 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } 1507 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); }
1507 static intptr_t unoptimized_code_offset() { 1508 static intptr_t unoptimized_code_offset() {
1508 return OFFSET_OF(RawFunction, unoptimized_code_); 1509 return OFFSET_OF(RawFunction, unoptimized_code_);
1509 } 1510 }
1510 inline bool HasCode() const; 1511 bool HasCode() const;
1511 1512
1512 // Returns true if there is at least one debugger breakpoint 1513 // Returns true if there is at least one debugger breakpoint
1513 // set in this function. 1514 // set in this function.
1514 bool HasBreakpoint() const; 1515 bool HasBreakpoint() const;
1515 1516
1516 RawContextScope* context_scope() const; 1517 RawContextScope* context_scope() const;
1517 void set_context_scope(const ContextScope& value) const; 1518 void set_context_scope(const ContextScope& value) const;
1518 1519
1519 // Enclosing function of this local function. 1520 // Enclosing function of this local function.
1520 RawFunction* parent_function() const; 1521 RawFunction* parent_function() const;
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 const TypeArguments& type_arguments, 1985 const TypeArguments& type_arguments,
1985 const Function& other, 1986 const Function& other,
1986 const TypeArguments& other_type_arguments, 1987 const TypeArguments& other_type_arguments,
1987 Error* bound_error) const; 1988 Error* bound_error) const;
1988 1989
1989 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object); 1990 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object);
1990 friend class Class; 1991 friend class Class;
1991 // RawFunction::VisitFunctionPointers accesses the private constructor of 1992 // RawFunction::VisitFunctionPointers accesses the private constructor of
1992 // Function. 1993 // Function.
1993 friend class RawFunction; 1994 friend class RawFunction;
1995 friend class MarkingVisitor; // Access to KindBits
1994 }; 1996 };
1995 1997
1996 1998
1997 class ClosureData: public Object { 1999 class ClosureData: public Object {
1998 public: 2000 public:
1999 static intptr_t InstanceSize() { 2001 static intptr_t InstanceSize() {
2000 return RoundedAllocationSize(sizeof(RawClosureData)); 2002 return RoundedAllocationSize(sizeof(RawClosureData));
2001 } 2003 }
2002 2004
2003 private: 2005 private:
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
2970 class Stackmap : public Object { 2972 class Stackmap : public Object {
2971 public: 2973 public:
2972 static const intptr_t kNoMaximum = -1; 2974 static const intptr_t kNoMaximum = -1;
2973 static const intptr_t kNoMinimum = -1; 2975 static const intptr_t kNoMinimum = -1;
2974 2976
2975 bool IsObject(intptr_t index) const { 2977 bool IsObject(intptr_t index) const {
2976 ASSERT(InRange(index)); 2978 ASSERT(InRange(index));
2977 return GetBit(index); 2979 return GetBit(index);
2978 } 2980 }
2979 2981
2980 RawCode* Code() const { return raw_ptr()->code_; }
2981 void SetCode(const dart::Code& code) const;
2982
2983 intptr_t Length() const { return raw_ptr()->length_; } 2982 intptr_t Length() const { return raw_ptr()->length_; }
2984 2983
2985 uword PC() const { return raw_ptr()->pc_; } 2984 uword PC() const { return raw_ptr()->pc_; }
2986 void SetPC(uword value) const { raw_ptr()->pc_ = value; } 2985 void SetPC(uword value) const { raw_ptr()->pc_ = value; }
2987 2986
2988 intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; } 2987 intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; }
2989 void SetRegisterBitCount(intptr_t register_bit_count) const { 2988 void SetRegisterBitCount(intptr_t register_bit_count) const {
2990 raw_ptr()->register_bit_count_ = register_bit_count; 2989 raw_ptr()->register_bit_count_ = register_bit_count;
2991 } 2990 }
2992 2991
(...skipping 3632 matching lines...) Expand 10 before | Expand all | Expand 10 after
6625 Isolate* isolate = Isolate::Current(); 6624 Isolate* isolate = Isolate::Current();
6626 Heap* isolate_heap = isolate->heap(); 6625 Heap* isolate_heap = isolate->heap();
6627 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); 6626 Heap* vm_isolate_heap = Dart::vm_isolate()->heap();
6628 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) || 6627 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) ||
6629 vm_isolate_heap->Contains(RawObject::ToAddr(raw_))); 6628 vm_isolate_heap->Contains(RawObject::ToAddr(raw_)));
6630 } 6629 }
6631 #endif 6630 #endif
6632 } 6631 }
6633 6632
6634 6633
6635 bool Function::HasCode() const {
6636 return raw_ptr()->code_ != Code::null();
6637 }
6638
6639
6640 intptr_t Field::Offset() const { 6634 intptr_t Field::Offset() const {
6641 ASSERT(!is_static()); // Offset is valid only for instance fields. 6635 ASSERT(!is_static()); // Offset is valid only for instance fields.
6642 intptr_t value = Smi::Value(reinterpret_cast<RawSmi*>(raw_ptr()->value_)); 6636 intptr_t value = Smi::Value(reinterpret_cast<RawSmi*>(raw_ptr()->value_));
6643 return (value * kWordSize); 6637 return (value * kWordSize);
6644 } 6638 }
6645 6639
6646 6640
6647 void Field::SetOffset(intptr_t value_in_bytes) const { 6641 void Field::SetOffset(intptr_t value_in_bytes) const {
6648 ASSERT(!is_static()); // SetOffset is valid only for instance fields. 6642 ASSERT(!is_static()); // SetOffset is valid only for instance fields.
6649 ASSERT(kWordSize != 0); 6643 ASSERT(kWordSize != 0);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
6732 6726
6733 6727
6734 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6728 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6735 intptr_t index) { 6729 intptr_t index) {
6736 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6730 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6737 } 6731 }
6738 6732
6739 } // namespace dart 6733 } // namespace dart
6740 6734
6741 #endif // VM_OBJECT_H_ 6735 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698