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

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

Issue 314953006: Implement LookupIterator designed to replace LookupResult (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Adding to BUILD.gn Created 6 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 | « src/ic.cc ('k') | src/lookup.h » ('j') | src/lookup.h » ('J')
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/v8.h" 8 #include "src/v8.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/utils.h" 10 #include "src/utils.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 332
333 template <bool is_ascii, typename Char> 333 template <bool is_ascii, typename Char>
334 void BasicJsonStringifier::Append_(const Char* chars) { 334 void BasicJsonStringifier::Append_(const Char* chars) {
335 for ( ; *chars != '\0'; chars++) Append_<is_ascii, Char>(*chars); 335 for ( ; *chars != '\0'; chars++) Append_<is_ascii, Char>(*chars);
336 } 336 }
337 337
338 338
339 MaybeHandle<Object> BasicJsonStringifier::ApplyToJsonFunction( 339 MaybeHandle<Object> BasicJsonStringifier::ApplyToJsonFunction(
340 Handle<Object> object, Handle<Object> key) { 340 Handle<Object> object, Handle<Object> key) {
341 LookupResult lookup(isolate_); 341 LookupIterator it(object, tojson_string_, LookupIterator::SKIP_INTERCEPTOR);
342 JSObject::cast(*object)->LookupRealNamedProperty(tojson_string_, &lookup);
343 if (!lookup.IsProperty()) return object;
344 PropertyAttributes attr;
345 Handle<Object> fun; 342 Handle<Object> fun;
346 ASSIGN_RETURN_ON_EXCEPTION( 343 ASSIGN_RETURN_ON_EXCEPTION(isolate_, fun, Object::GetProperty(&it), Object);
347 isolate_, fun,
348 Object::GetProperty(object, object, &lookup, tojson_string_, &attr),
349 Object);
350 if (!fun->IsJSFunction()) return object; 344 if (!fun->IsJSFunction()) return object;
351 345
352 // Call toJSON function. 346 // Call toJSON function.
353 if (key->IsSmi()) key = factory_->NumberToString(key); 347 if (key->IsSmi()) key = factory_->NumberToString(key);
354 Handle<Object> argv[] = { key }; 348 Handle<Object> argv[] = { key };
355 HandleScope scope(isolate_); 349 HandleScope scope(isolate_);
356 ASSIGN_RETURN_ON_EXCEPTION( 350 ASSIGN_RETURN_ON_EXCEPTION(
357 isolate_, object, 351 isolate_, object,
358 Execution::Call(isolate_, fun, object, 1, argv), 352 Execution::Call(isolate_, fun, object, 1, argv),
359 Object); 353 Object);
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 SerializeString_<false, uint8_t>(object); 869 SerializeString_<false, uint8_t>(object);
876 } else { 870 } else {
877 SerializeString_<false, uc16>(object); 871 SerializeString_<false, uc16>(object);
878 } 872 }
879 } 873 }
880 } 874 }
881 875
882 } } // namespace v8::internal 876 } } // namespace v8::internal
883 877
884 #endif // V8_JSON_STRINGIFIER_H_ 878 #endif // V8_JSON_STRINGIFIER_H_
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/lookup.h » ('j') | src/lookup.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698