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

Side by Side Diff: src/objects.cc

Issue 93066: Built-in JSON support (Closed)
Patch Set: Created 11 years, 8 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 351
352 Object* JSObject::GetLazyProperty(Object* receiver, 352 Object* JSObject::GetLazyProperty(Object* receiver,
353 LookupResult* result, 353 LookupResult* result,
354 String* name, 354 String* name,
355 PropertyAttributes* attributes) { 355 PropertyAttributes* attributes) {
356 HandleScope scope; 356 HandleScope scope;
357 Handle<Object> this_handle(this); 357 Handle<Object> this_handle(this);
358 Handle<Object> receiver_handle(receiver); 358 Handle<Object> receiver_handle(receiver);
359 Handle<String> name_handle(name); 359 Handle<String> name_handle(name);
360 bool pending_exception; 360 bool pending_exception;
361 LoadLazy(Handle<JSFunction>(JSFunction::cast(result->GetValue())), 361 LoadLazy(Handle<JSObject>(JSObject::cast(result->GetLazyValue())),
362 &pending_exception); 362 &pending_exception);
363 if (pending_exception) return Failure::Exception(); 363 if (pending_exception) return Failure::Exception();
364 return this_handle->GetPropertyWithReceiver(*receiver_handle, 364 return this_handle->GetPropertyWithReceiver(*receiver_handle,
365 *name_handle, 365 *name_handle,
366 attributes); 366 attributes);
367 } 367 }
368 368
369 369
370 Object* JSObject::SetLazyProperty(LookupResult* result, 370 Object* JSObject::SetLazyProperty(LookupResult* result,
371 String* name, 371 String* name,
372 Object* value, 372 Object* value,
373 PropertyAttributes attributes) { 373 PropertyAttributes attributes) {
374 ASSERT(!IsJSGlobalProxy()); 374 ASSERT(!IsJSGlobalProxy());
375 HandleScope scope; 375 HandleScope scope;
376 Handle<JSObject> this_handle(this); 376 Handle<JSObject> this_handle(this);
377 Handle<String> name_handle(name); 377 Handle<String> name_handle(name);
378 Handle<Object> value_handle(value); 378 Handle<Object> value_handle(value);
379 bool pending_exception; 379 bool pending_exception;
380 LoadLazy(Handle<JSFunction>(JSFunction::cast(result->GetValue())), 380 LoadLazy(Handle<JSObject>(JSObject::cast(result->GetLazyValue())),
381 &pending_exception); 381 &pending_exception);
382 if (pending_exception) return Failure::Exception(); 382 if (pending_exception) return Failure::Exception();
383 return this_handle->SetProperty(*name_handle, *value_handle, attributes); 383 return this_handle->SetProperty(*name_handle, *value_handle, attributes);
384 } 384 }
385 385
386 386
387 Object* JSObject::DeleteLazyProperty(LookupResult* result, String* name) { 387 Object* JSObject::DeleteLazyProperty(LookupResult* result, String* name) {
388 HandleScope scope; 388 HandleScope scope;
389 Handle<JSObject> this_handle(this); 389 Handle<JSObject> this_handle(this);
390 Handle<String> name_handle(name); 390 Handle<String> name_handle(name);
391 bool pending_exception; 391 bool pending_exception;
392 LoadLazy(Handle<JSFunction>(JSFunction::cast(result->GetValue())), 392 LoadLazy(Handle<JSObject>(JSObject::cast(result->GetLazyValue())),
393 &pending_exception); 393 &pending_exception);
394 if (pending_exception) return Failure::Exception(); 394 if (pending_exception) return Failure::Exception();
395 return this_handle->DeleteProperty(*name_handle); 395 return this_handle->DeleteProperty(*name_handle);
396 } 396 }
397 397
398 398
399 Object* Object::GetProperty(Object* receiver, 399 Object* Object::GetProperty(Object* receiver,
400 LookupResult* result, 400 LookupResult* result,
401 String* name, 401 String* name,
402 PropertyAttributes* attributes) { 402 PropertyAttributes* attributes) {
(...skipping 2305 matching lines...) Expand 10 before | Expand all | Expand 10 after
2708 Object* result = Heap::AllocateMap(instance_type(), instance_size()); 2708 Object* result = Heap::AllocateMap(instance_type(), instance_size());
2709 if (result->IsFailure()) return result; 2709 if (result->IsFailure()) return result;
2710 Map::cast(result)->set_prototype(prototype()); 2710 Map::cast(result)->set_prototype(prototype());
2711 Map::cast(result)->set_constructor(constructor()); 2711 Map::cast(result)->set_constructor(constructor());
2712 // Don't copy descriptors, so map transitions always remain a forest. 2712 // Don't copy descriptors, so map transitions always remain a forest.
2713 Map::cast(result)->set_instance_descriptors(Heap::empty_descriptor_array()); 2713 Map::cast(result)->set_instance_descriptors(Heap::empty_descriptor_array());
2714 // Please note instance_type and instance_size are set when allocated. 2714 // Please note instance_type and instance_size are set when allocated.
2715 Map::cast(result)->set_inobject_properties(inobject_properties()); 2715 Map::cast(result)->set_inobject_properties(inobject_properties());
2716 Map::cast(result)->set_unused_property_fields(unused_property_fields()); 2716 Map::cast(result)->set_unused_property_fields(unused_property_fields());
2717 Map::cast(result)->set_bit_field(bit_field()); 2717 Map::cast(result)->set_bit_field(bit_field());
2718 Map::cast(result)->set_bit_field2(bit_field2());
2718 Map::cast(result)->ClearCodeCache(); 2719 Map::cast(result)->ClearCodeCache();
2719 return result; 2720 return result;
2720 } 2721 }
2721 2722
2722 2723
2723 Object* Map::CopyDropTransitions() { 2724 Object* Map::CopyDropTransitions() {
2724 Object* new_map = Copy(); 2725 Object* new_map = Copy();
2725 if (new_map->IsFailure()) return new_map; 2726 if (new_map->IsFailure()) return new_map;
2726 Object* descriptors = instance_descriptors()->RemoveTransitions(); 2727 Object* descriptors = instance_descriptors()->RemoveTransitions();
2727 if (descriptors->IsFailure()) return descriptors; 2728 if (descriptors->IsFailure()) return descriptors;
(...skipping 4684 matching lines...) Expand 10 before | Expand all | Expand 10 after
7412 // No break point. 7413 // No break point.
7413 if (break_point_objects()->IsUndefined()) return 0; 7414 if (break_point_objects()->IsUndefined()) return 0;
7414 // Single beak point. 7415 // Single beak point.
7415 if (!break_point_objects()->IsFixedArray()) return 1; 7416 if (!break_point_objects()->IsFixedArray()) return 1;
7416 // Multiple break points. 7417 // Multiple break points.
7417 return FixedArray::cast(break_point_objects())->length(); 7418 return FixedArray::cast(break_point_objects())->length();
7418 } 7419 }
7419 #endif 7420 #endif
7420 7421
7421 } } // namespace v8::internal 7422 } } // namespace v8::internal
OLDNEW
« src/objects.h ('K') | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698