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

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

Issue 1333843002: [runtime] Move binary operator fallbacks into the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: No need for frame states in bytecode handlers. Add test case. Created 5 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
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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSValue( 379 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSValue(
380 Handle<JSValue> object) { 380 Handle<JSValue> object) {
381 String* class_name = object->class_name(); 381 String* class_name = object->class_name();
382 if (class_name == isolate_->heap()->String_string()) { 382 if (class_name == isolate_->heap()->String_string()) {
383 Handle<Object> value; 383 Handle<Object> value;
384 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 384 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
385 isolate_, value, Object::ToString(isolate_, object), EXCEPTION); 385 isolate_, value, Object::ToString(isolate_, object), EXCEPTION);
386 SerializeString(Handle<String>::cast(value)); 386 SerializeString(Handle<String>::cast(value));
387 } else if (class_name == isolate_->heap()->Number_string()) { 387 } else if (class_name == isolate_->heap()->Number_string()) {
388 Handle<Object> value; 388 Handle<Object> value;
389 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 389 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate_, value, Object::ToNumber(object),
390 isolate_, value, Object::ToNumber(isolate_, object), EXCEPTION); 390 EXCEPTION);
391 if (value->IsSmi()) return SerializeSmi(Smi::cast(*value)); 391 if (value->IsSmi()) return SerializeSmi(Smi::cast(*value));
392 SerializeHeapNumber(Handle<HeapNumber>::cast(value)); 392 SerializeHeapNumber(Handle<HeapNumber>::cast(value));
393 } else if (class_name == isolate_->heap()->Boolean_string()) { 393 } else if (class_name == isolate_->heap()->Boolean_string()) {
394 Object* value = JSValue::cast(*object)->value(); 394 Object* value = JSValue::cast(*object)->value();
395 DCHECK(value->IsBoolean()); 395 DCHECK(value->IsBoolean());
396 builder_.AppendCString(value->IsTrue() ? "true" : "false"); 396 builder_.AppendCString(value->IsTrue() ? "true" : "false");
397 } else { 397 } else {
398 // Fail gracefully for special value wrappers. 398 // Fail gracefully for special value wrappers.
399 isolate_->ThrowIllegalOperation(); 399 isolate_->ThrowIllegalOperation();
400 return EXCEPTION; 400 return EXCEPTION;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 SerializeString_<uint8_t, uc16>(object); 671 SerializeString_<uint8_t, uc16>(object);
672 } else { 672 } else {
673 SerializeString_<uc16, uc16>(object); 673 SerializeString_<uc16, uc16>(object);
674 } 674 }
675 } 675 }
676 } 676 }
677 677
678 } } // namespace v8::internal 678 } } // namespace v8::internal
679 679
680 #endif // V8_JSON_STRINGIFIER_H_ 680 #endif // V8_JSON_STRINGIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698