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

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

Issue 10542032: Small efficiency fix. (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
« no previous file with comments | « no previous file | no next file » | 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 "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 4129 matching lines...) Expand 10 before | Expand all | Expand 10 after
4140 4140
4141 RawString* Field::SetterSymbol(const String& field_name) { 4141 RawString* Field::SetterSymbol(const String& field_name) {
4142 String& str = String::Handle(); 4142 String& str = String::Handle();
4143 str = Field::SetterName(field_name); 4143 str = Field::SetterName(field_name);
4144 return String::NewSymbol(str); 4144 return String::NewSymbol(str);
4145 } 4145 }
4146 4146
4147 4147
4148 RawString* Field::NameFromGetter(const String& getter_name) { 4148 RawString* Field::NameFromGetter(const String& getter_name) {
4149 String& str = String::Handle(); 4149 String& str = String::Handle();
4150 str = String::New(kGetterPrefix); 4150 str = String::SubString(getter_name, strlen(kGetterPrefix));
4151 str = String::SubString(getter_name, str.Length());
4152 return str.raw(); 4151 return str.raw();
4153 } 4152 }
4154 4153
4155 4154
4156 RawString* Field::NameFromSetter(const String& setter_name) { 4155 RawString* Field::NameFromSetter(const String& setter_name) {
4157 String& str = String::Handle(); 4156 String& str = String::Handle();
4158 str = String::New(kSetterPrefix); 4157 str = String::SubString(setter_name, strlen(kSetterPrefix));
4159 str = String::SubString(setter_name, str.Length());
4160 return str.raw(); 4158 return str.raw();
4161 } 4159 }
4162 4160
4163 4161
4164 void Field::set_name(const String& value) const { 4162 void Field::set_name(const String& value) const {
4165 ASSERT(value.IsSymbol()); 4163 ASSERT(value.IsSymbol());
4166 StorePointer(&raw_ptr()->name_, value.raw()); 4164 StorePointer(&raw_ptr()->name_, value.raw());
4167 } 4165 }
4168 4166
4169 4167
(...skipping 5930 matching lines...) Expand 10 before | Expand all | Expand 10 after
10100 const String& str = String::Handle(pattern()); 10098 const String& str = String::Handle(pattern());
10101 const char* format = "JSRegExp: pattern=%s flags=%s"; 10099 const char* format = "JSRegExp: pattern=%s flags=%s";
10102 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 10100 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
10103 char* chars = reinterpret_cast<char*>( 10101 char* chars = reinterpret_cast<char*>(
10104 Isolate::Current()->current_zone()->Allocate(len + 1)); 10102 Isolate::Current()->current_zone()->Allocate(len + 1));
10105 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 10103 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
10106 return chars; 10104 return chars;
10107 } 10105 }
10108 10106
10109 } // namespace dart 10107 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698