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

Side by Side Diff: src/objects.cc

Issue 7860011: Rename SmartPointer to SmartArrayPointer. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: rebase it again to get more fixes Created 9 years, 3 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
« no previous file with comments | « src/objects.h ('k') | src/parser.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5064 matching lines...) Expand 10 before | Expand all | Expand 10 after
5075 if (shape.representation_tag() == kSeqStringTag) { 5075 if (shape.representation_tag() == kSeqStringTag) {
5076 start = SeqTwoByteString::cast(string)->GetChars(); 5076 start = SeqTwoByteString::cast(string)->GetChars();
5077 } else { 5077 } else {
5078 start = ExternalTwoByteString::cast(string)->resource()->data(); 5078 start = ExternalTwoByteString::cast(string)->resource()->data();
5079 } 5079 }
5080 return FlatContent(Vector<const uc16>(start + offset, length)); 5080 return FlatContent(Vector<const uc16>(start + offset, length));
5081 } 5081 }
5082 } 5082 }
5083 5083
5084 5084
5085 SmartPointer<char> String::ToCString(AllowNullsFlag allow_nulls, 5085 SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls,
5086 RobustnessFlag robust_flag, 5086 RobustnessFlag robust_flag,
5087 int offset, 5087 int offset,
5088 int length, 5088 int length,
5089 int* length_return) { 5089 int* length_return) {
5090 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) { 5090 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) {
5091 return SmartPointer<char>(NULL); 5091 return SmartArrayPointer<char>(NULL);
5092 } 5092 }
5093 Heap* heap = GetHeap(); 5093 Heap* heap = GetHeap();
5094 5094
5095 // Negative length means the to the end of the string. 5095 // Negative length means the to the end of the string.
5096 if (length < 0) length = kMaxInt - offset; 5096 if (length < 0) length = kMaxInt - offset;
5097 5097
5098 // Compute the size of the UTF-8 string. Start at the specified offset. 5098 // Compute the size of the UTF-8 string. Start at the specified offset.
5099 Access<StringInputBuffer> buffer( 5099 Access<StringInputBuffer> buffer(
5100 heap->isolate()->objects_string_input_buffer()); 5100 heap->isolate()->objects_string_input_buffer());
5101 buffer->Reset(offset, this); 5101 buffer->Reset(offset, this);
(...skipping 23 matching lines...) Expand all
5125 if (character_position < offset + length) { 5125 if (character_position < offset + length) {
5126 if (allow_nulls == DISALLOW_NULLS && character == 0) { 5126 if (allow_nulls == DISALLOW_NULLS && character == 0) {
5127 character = ' '; 5127 character = ' ';
5128 } 5128 }
5129 utf8_byte_position += 5129 utf8_byte_position +=
5130 unibrow::Utf8::Encode(result + utf8_byte_position, character); 5130 unibrow::Utf8::Encode(result + utf8_byte_position, character);
5131 } 5131 }
5132 character_position++; 5132 character_position++;
5133 } 5133 }
5134 result[utf8_byte_position] = 0; 5134 result[utf8_byte_position] = 0;
5135 return SmartPointer<char>(result); 5135 return SmartArrayPointer<char>(result);
5136 } 5136 }
5137 5137
5138 5138
5139 SmartPointer<char> String::ToCString(AllowNullsFlag allow_nulls, 5139 SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls,
5140 RobustnessFlag robust_flag, 5140 RobustnessFlag robust_flag,
5141 int* length_return) { 5141 int* length_return) {
5142 return ToCString(allow_nulls, robust_flag, 0, -1, length_return); 5142 return ToCString(allow_nulls, robust_flag, 0, -1, length_return);
5143 } 5143 }
5144 5144
5145 5145
5146 const uc16* String::GetTwoByteData() { 5146 const uc16* String::GetTwoByteData() {
5147 return GetTwoByteData(0); 5147 return GetTwoByteData(0);
5148 } 5148 }
5149 5149
5150 5150
5151 const uc16* String::GetTwoByteData(unsigned start) { 5151 const uc16* String::GetTwoByteData(unsigned start) {
(...skipping 10 matching lines...) Expand all
5162 } 5162 }
5163 case kConsStringTag: 5163 case kConsStringTag:
5164 UNREACHABLE(); 5164 UNREACHABLE();
5165 return NULL; 5165 return NULL;
5166 } 5166 }
5167 UNREACHABLE(); 5167 UNREACHABLE();
5168 return NULL; 5168 return NULL;
5169 } 5169 }
5170 5170
5171 5171
5172 SmartPointer<uc16> String::ToWideCString(RobustnessFlag robust_flag) { 5172 SmartArrayPointer<uc16> String::ToWideCString(RobustnessFlag robust_flag) {
5173 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) { 5173 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) {
5174 return SmartPointer<uc16>(); 5174 return SmartArrayPointer<uc16>();
5175 } 5175 }
5176 Heap* heap = GetHeap(); 5176 Heap* heap = GetHeap();
5177 5177
5178 Access<StringInputBuffer> buffer( 5178 Access<StringInputBuffer> buffer(
5179 heap->isolate()->objects_string_input_buffer()); 5179 heap->isolate()->objects_string_input_buffer());
5180 buffer->Reset(this); 5180 buffer->Reset(this);
5181 5181
5182 uc16* result = NewArray<uc16>(length() + 1); 5182 uc16* result = NewArray<uc16>(length() + 1);
5183 5183
5184 int i = 0; 5184 int i = 0;
5185 while (buffer->has_more()) { 5185 while (buffer->has_more()) {
5186 uint16_t character = buffer->GetNext(); 5186 uint16_t character = buffer->GetNext();
5187 result[i++] = character; 5187 result[i++] = character;
5188 } 5188 }
5189 result[i] = 0; 5189 result[i] = 0;
5190 return SmartPointer<uc16>(result); 5190 return SmartArrayPointer<uc16>(result);
5191 } 5191 }
5192 5192
5193 5193
5194 const uc16* SeqTwoByteString::SeqTwoByteStringGetData(unsigned start) { 5194 const uc16* SeqTwoByteString::SeqTwoByteStringGetData(unsigned start) {
5195 return reinterpret_cast<uc16*>( 5195 return reinterpret_cast<uc16*>(
5196 reinterpret_cast<char*>(this) - kHeapObjectTag + kHeaderSize) + start; 5196 reinterpret_cast<char*>(this) - kHeapObjectTag + kHeaderSize) + start;
5197 } 5197 }
5198 5198
5199 5199
5200 void SeqTwoByteString::SeqTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer* rbb, 5200 void SeqTwoByteString::SeqTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer* rbb,
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
6397 } 6397 }
6398 6398
6399 6399
6400 Object* JSFunction::SetInstanceClassName(String* name) { 6400 Object* JSFunction::SetInstanceClassName(String* name) {
6401 shared()->set_instance_class_name(name); 6401 shared()->set_instance_class_name(name);
6402 return this; 6402 return this;
6403 } 6403 }
6404 6404
6405 6405
6406 void JSFunction::PrintName(FILE* out) { 6406 void JSFunction::PrintName(FILE* out) {
6407 SmartPointer<char> name = shared()->DebugName()->ToCString(); 6407 SmartArrayPointer<char> name = shared()->DebugName()->ToCString();
6408 PrintF(out, "%s", *name); 6408 PrintF(out, "%s", *name);
6409 } 6409 }
6410 6410
6411 6411
6412 Context* JSFunction::GlobalContextFromLiterals(FixedArray* literals) { 6412 Context* JSFunction::GlobalContextFromLiterals(FixedArray* literals) {
6413 return Context::cast(literals->get(JSFunction::kLiteralGlobalContextIndex)); 6413 return Context::cast(literals->get(JSFunction::kLiteralGlobalContextIndex));
6414 } 6414 }
6415 6415
6416 6416
6417 MaybeObject* Oddball::Initialize(const char* to_string, 6417 MaybeObject* Oddball::Initialize(const char* to_string,
(...skipping 5180 matching lines...) Expand 10 before | Expand all | Expand 10 after
11598 if (break_point_objects()->IsUndefined()) return 0; 11598 if (break_point_objects()->IsUndefined()) return 0;
11599 // Single break point. 11599 // Single break point.
11600 if (!break_point_objects()->IsFixedArray()) return 1; 11600 if (!break_point_objects()->IsFixedArray()) return 1;
11601 // Multiple break points. 11601 // Multiple break points.
11602 return FixedArray::cast(break_point_objects())->length(); 11602 return FixedArray::cast(break_point_objects())->length();
11603 } 11603 }
11604 #endif 11604 #endif
11605 11605
11606 11606
11607 } } // namespace v8::internal 11607 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698