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

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

Issue 10540040: Inline setters, getters, various cleanups & restructuring. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 4141 matching lines...) Expand 10 before | Expand all | Expand 10 after
4152 } 4152 }
4153 4153
4154 4154
4155 RawString* Field::NameFromSetter(const String& setter_name) { 4155 RawString* Field::NameFromSetter(const String& setter_name) {
4156 String& str = String::Handle(); 4156 String& str = String::Handle();
4157 str = String::SubString(setter_name, strlen(kSetterPrefix)); 4157 str = String::SubString(setter_name, strlen(kSetterPrefix));
4158 return str.raw(); 4158 return str.raw();
4159 } 4159 }
4160 4160
4161 4161
4162 bool Field::IsGetterName(const String& function_name) {
4163 return function_name.StartsWith(String::Handle(String::New(kGetterPrefix)));
4164 }
4165
4166
4167 bool Field::IsSetterName(const String& function_name) {
4168 return function_name.StartsWith(String::Handle(String::New(kSetterPrefix)));
4169 }
4170
4171
4162 void Field::set_name(const String& value) const { 4172 void Field::set_name(const String& value) const {
4163 ASSERT(value.IsSymbol()); 4173 ASSERT(value.IsSymbol());
4164 StorePointer(&raw_ptr()->name_, value.raw()); 4174 StorePointer(&raw_ptr()->name_, value.raw());
4165 } 4175 }
4166 4176
4167 4177
4168 RawInstance* Field::value() const { 4178 RawInstance* Field::value() const {
4169 ASSERT(is_static()); // Valid only for static dart fields. 4179 ASSERT(is_static()); // Valid only for static dart fields.
4170 return raw_ptr()->value_; 4180 return raw_ptr()->value_;
4171 } 4181 }
(...skipping 5926 matching lines...) Expand 10 before | Expand all | Expand 10 after
10098 const String& str = String::Handle(pattern()); 10108 const String& str = String::Handle(pattern());
10099 const char* format = "JSRegExp: pattern=%s flags=%s"; 10109 const char* format = "JSRegExp: pattern=%s flags=%s";
10100 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 10110 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
10101 char* chars = reinterpret_cast<char*>( 10111 char* chars = reinterpret_cast<char*>(
10102 Isolate::Current()->current_zone()->Allocate(len + 1)); 10112 Isolate::Current()->current_zone()->Allocate(len + 1));
10103 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 10113 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
10104 return chars; 10114 return chars;
10105 } 10115 }
10106 10116
10107 } // namespace dart 10117 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698