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

Side by Side Diff: src/api.cc

Issue 5718005: API: Correct documentation of String::WriteUtf8, String::Write... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years 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 | « include/v8.h ('k') | test/cctest/test-api.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 3109 matching lines...) Expand 10 before | Expand all | Expand 10 after
3120 LOG_API("String::Write"); 3120 LOG_API("String::Write");
3121 ENTER_V8; 3121 ENTER_V8;
3122 ASSERT(start >= 0 && length >= -1); 3122 ASSERT(start >= 0 && length >= -1);
3123 i::Handle<i::String> str = Utils::OpenHandle(this); 3123 i::Handle<i::String> str = Utils::OpenHandle(this);
3124 StringTracker::RecordWrite(str); 3124 StringTracker::RecordWrite(str);
3125 if (hints & HINT_MANY_WRITES_EXPECTED) { 3125 if (hints & HINT_MANY_WRITES_EXPECTED) {
3126 // Flatten the string for efficiency. This applies whether we are 3126 // Flatten the string for efficiency. This applies whether we are
3127 // using StringInputBuffer or Get(i) to access the characters. 3127 // using StringInputBuffer or Get(i) to access the characters.
3128 str->TryFlatten(); 3128 str->TryFlatten();
3129 } 3129 }
3130 int end = length; 3130 int end = start + length;
3131 if ( (length == -1) || (length > str->length() - start) ) 3131 if ((length == -1) || (length > str->length() - start) )
3132 end = str->length() - start; 3132 end = str->length();
3133 if (end < 0) return 0; 3133 if (end < 0) return 0;
3134 i::String::WriteToFlat(*str, buffer, start, end); 3134 i::String::WriteToFlat(*str, buffer, start, end);
3135 if (length == -1 || end < length) 3135 if (length == -1 || end - start < length) {
3136 buffer[end] = '\0'; 3136 buffer[end - start] = '\0';
3137 return end; 3137 }
3138 return end - start;
3138 } 3139 }
3139 3140
3140 3141
3141 bool v8::String::IsExternal() const { 3142 bool v8::String::IsExternal() const {
3142 EnsureInitialized("v8::String::IsExternal()"); 3143 EnsureInitialized("v8::String::IsExternal()");
3143 i::Handle<i::String> str = Utils::OpenHandle(this); 3144 i::Handle<i::String> str = Utils::OpenHandle(this);
3144 return i::StringShape(*str).IsExternalTwoByte(); 3145 return i::StringShape(*str).IsExternalTwoByte();
3145 } 3146 }
3146 3147
3147 3148
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
5105 5106
5106 5107
5107 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5108 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5108 HandleScopeImplementer* thread_local = 5109 HandleScopeImplementer* thread_local =
5109 reinterpret_cast<HandleScopeImplementer*>(storage); 5110 reinterpret_cast<HandleScopeImplementer*>(storage);
5110 thread_local->IterateThis(v); 5111 thread_local->IterateThis(v);
5111 return storage + ArchiveSpacePerThread(); 5112 return storage + ArchiveSpacePerThread();
5112 } 5113 }
5113 5114
5114 } } // namespace v8::internal 5115 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698