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

Side by Side Diff: src/json-stringifier.h

Issue 1423833003: Canonicalize handles for optimized compilation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 years, 1 month 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/isolate.cc ('k') | src/mips/macro-assembler-mips.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_JSON_STRINGIFIER_H_ 5 #ifndef V8_JSON_STRINGIFIER_H_
6 #define V8_JSON_STRINGIFIER_H_ 6 #define V8_JSON_STRINGIFIER_H_
7 7
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/lookup.h" 9 #include "src/lookup.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 if (object->IsOneByteRepresentationUnderneath()) { 215 if (object->IsOneByteRepresentationUnderneath()) {
216 result = isolate->factory() 216 result = isolate->factory()
217 ->NewRawOneByteString(worst_case_length) 217 ->NewRawOneByteString(worst_case_length)
218 .ToHandleChecked(); 218 .ToHandleChecked();
219 IncrementalStringBuilder::NoExtendString<uint8_t> no_extend( 219 IncrementalStringBuilder::NoExtendString<uint8_t> no_extend(
220 result, worst_case_length); 220 result, worst_case_length);
221 no_extend.Append('\"'); 221 no_extend.Append('\"');
222 SerializeStringUnchecked_(object->GetFlatContent().ToOneByteVector(), 222 SerializeStringUnchecked_(object->GetFlatContent().ToOneByteVector(),
223 &no_extend); 223 &no_extend);
224 no_extend.Append('\"'); 224 no_extend.Append('\"');
225 return no_extend.Finalize();
225 } else { 226 } else {
226 result = isolate->factory() 227 result = isolate->factory()
227 ->NewRawTwoByteString(worst_case_length) 228 ->NewRawTwoByteString(worst_case_length)
228 .ToHandleChecked(); 229 .ToHandleChecked();
229 IncrementalStringBuilder::NoExtendString<uc16> no_extend(result, 230 IncrementalStringBuilder::NoExtendString<uc16> no_extend(result,
230 worst_case_length); 231 worst_case_length);
231 no_extend.Append('\"'); 232 no_extend.Append('\"');
232 SerializeStringUnchecked_(object->GetFlatContent().ToUC16Vector(), 233 SerializeStringUnchecked_(object->GetFlatContent().ToUC16Vector(),
233 &no_extend); 234 &no_extend);
234 no_extend.Append('\"'); 235 no_extend.Append('\"');
236 return no_extend.Finalize();
235 } 237 }
236 return result;
237 } 238 }
238 239
239 240
240 MaybeHandle<Object> BasicJsonStringifier::ApplyToJsonFunction( 241 MaybeHandle<Object> BasicJsonStringifier::ApplyToJsonFunction(
241 Handle<Object> object, Handle<Object> key) { 242 Handle<Object> object, Handle<Object> key) {
242 LookupIterator it(object, tojson_string_, 243 LookupIterator it(object, tojson_string_,
243 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); 244 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
244 Handle<Object> fun; 245 Handle<Object> fun;
245 ASSIGN_RETURN_ON_EXCEPTION(isolate_, fun, Object::GetProperty(&it), Object); 246 ASSIGN_RETURN_ON_EXCEPTION(isolate_, fun, Object::GetProperty(&it), Object);
246 if (!fun->IsJSFunction()) return object; 247 if (!fun->IsJSFunction()) return object;
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 } else { 673 } else {
673 SerializeString_<uc16, uc16>(object); 674 SerializeString_<uc16, uc16>(object);
674 } 675 }
675 } 676 }
676 } 677 }
677 678
678 } // namespace internal 679 } // namespace internal
679 } // namespace v8 680 } // namespace v8
680 681
681 #endif // V8_JSON_STRINGIFIER_H_ 682 #endif // V8_JSON_STRINGIFIER_H_
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698