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

Side by Side Diff: src/runtime.cc

Issue 11365111: Object.observe: generate change records for indexed properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing comments; simplifications. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-inl.h ('k') | test/mjsunit/harmony/object-observe.js » ('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 // 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 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 static MaybeObject* GetOwnProperty(Isolate* isolate, 1066 static MaybeObject* GetOwnProperty(Isolate* isolate,
1067 Handle<JSObject> obj, 1067 Handle<JSObject> obj,
1068 Handle<String> name) { 1068 Handle<String> name) {
1069 Heap* heap = isolate->heap(); 1069 Heap* heap = isolate->heap();
1070 Handle<FixedArray> elms = isolate->factory()->NewFixedArray(DESCRIPTOR_SIZE); 1070 Handle<FixedArray> elms = isolate->factory()->NewFixedArray(DESCRIPTOR_SIZE);
1071 Handle<JSArray> desc = isolate->factory()->NewJSArrayWithElements(elms); 1071 Handle<JSArray> desc = isolate->factory()->NewJSArrayWithElements(elms);
1072 LookupResult result(isolate); 1072 LookupResult result(isolate);
1073 // This could be an element. 1073 // This could be an element.
1074 uint32_t index; 1074 uint32_t index;
1075 if (name->AsArrayIndex(&index)) { 1075 if (name->AsArrayIndex(&index)) {
1076 switch (obj->HasLocalElement(index)) { 1076 switch (obj->GetLocalElementType(index)) {
1077 case JSObject::UNDEFINED_ELEMENT: 1077 case JSObject::UNDEFINED_ELEMENT:
1078 return heap->undefined_value(); 1078 return heap->undefined_value();
1079 1079
1080 case JSObject::STRING_CHARACTER_ELEMENT: { 1080 case JSObject::STRING_CHARACTER_ELEMENT: {
1081 // Special handling of string objects according to ECMAScript 5 1081 // Special handling of string objects according to ECMAScript 5
1082 // 15.5.5.2. Note that this might be a string object with elements 1082 // 15.5.5.2. Note that this might be a string object with elements
1083 // other than the actual string value. This is covered by the 1083 // other than the actual string value. This is covered by the
1084 // subsequent cases. 1084 // subsequent cases.
1085 Handle<JSValue> js_value = Handle<JSValue>::cast(obj); 1085 Handle<JSValue> js_value = Handle<JSValue>::cast(obj);
1086 Handle<String> str(String::cast(js_value->value())); 1086 Handle<String> str(String::cast(js_value->value()));
(...skipping 3587 matching lines...) Expand 10 before | Expand all | Expand 10 after
4674 4674
4675 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsPropertyEnumerable) { 4675 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsPropertyEnumerable) {
4676 NoHandleAllocation ha; 4676 NoHandleAllocation ha;
4677 ASSERT(args.length() == 2); 4677 ASSERT(args.length() == 2);
4678 4678
4679 CONVERT_ARG_CHECKED(JSObject, object, 0); 4679 CONVERT_ARG_CHECKED(JSObject, object, 0);
4680 CONVERT_ARG_CHECKED(String, key, 1); 4680 CONVERT_ARG_CHECKED(String, key, 1);
4681 4681
4682 uint32_t index; 4682 uint32_t index;
4683 if (key->AsArrayIndex(&index)) { 4683 if (key->AsArrayIndex(&index)) {
4684 JSObject::LocalElementType type = object->HasLocalElement(index); 4684 JSObject::LocalElementType type = object->GetLocalElementType(index);
4685 switch (type) { 4685 switch (type) {
4686 case JSObject::UNDEFINED_ELEMENT: 4686 case JSObject::UNDEFINED_ELEMENT:
4687 case JSObject::STRING_CHARACTER_ELEMENT: 4687 case JSObject::STRING_CHARACTER_ELEMENT:
4688 return isolate->heap()->false_value(); 4688 return isolate->heap()->false_value();
4689 case JSObject::INTERCEPTED_ELEMENT: 4689 case JSObject::INTERCEPTED_ELEMENT:
4690 case JSObject::FAST_ELEMENT: 4690 case JSObject::FAST_ELEMENT:
4691 return isolate->heap()->true_value(); 4691 return isolate->heap()->true_value();
4692 case JSObject::DICTIONARY_ELEMENT: { 4692 case JSObject::DICTIONARY_ELEMENT: {
4693 if (object->IsJSGlobalProxy()) { 4693 if (object->IsJSGlobalProxy()) {
4694 Object* proto = object->GetPrototype(); 4694 Object* proto = object->GetPrototype();
(...skipping 8629 matching lines...) Expand 10 before | Expand all | Expand 10 after
13324 // Handle last resort GC and make sure to allow future allocations 13324 // Handle last resort GC and make sure to allow future allocations
13325 // to grow the heap without causing GCs (if possible). 13325 // to grow the heap without causing GCs (if possible).
13326 isolate->counters()->gc_last_resort_from_js()->Increment(); 13326 isolate->counters()->gc_last_resort_from_js()->Increment();
13327 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13327 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13328 "Runtime::PerformGC"); 13328 "Runtime::PerformGC");
13329 } 13329 }
13330 } 13330 }
13331 13331
13332 13332
13333 } } // namespace v8::internal 13333 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | test/mjsunit/harmony/object-observe.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698