OLD | NEW |
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 13366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13377 if (obj->IsNull()) return isolate->heap()->undefined_value(); | 13377 if (obj->IsNull()) return isolate->heap()->undefined_value(); |
13378 ASSERT(proto->IsJSGlobalObject()); | 13378 ASSERT(proto->IsJSGlobalObject()); |
13379 obj = JSReceiver::cast(proto); | 13379 obj = JSReceiver::cast(proto); |
13380 } | 13380 } |
13381 if (obj->map()->is_observed() != is_observed) { | 13381 if (obj->map()->is_observed() != is_observed) { |
13382 MaybeObject* maybe = obj->map()->Copy(); | 13382 MaybeObject* maybe = obj->map()->Copy(); |
13383 Map* map; | 13383 Map* map; |
13384 if (!maybe->To(&map)) return maybe; | 13384 if (!maybe->To(&map)) return maybe; |
13385 map->set_is_observed(is_observed); | 13385 map->set_is_observed(is_observed); |
13386 obj->set_map(map); | 13386 obj->set_map(map); |
| 13387 if (is_observed && obj->IsJSObject() && |
| 13388 !JSObject::cast(obj)->HasExternalArrayElements()) { |
| 13389 // Go to dictionary mode, so that we don't skip map checks. |
| 13390 maybe = JSObject::cast(obj)->NormalizeElements(); |
| 13391 if (maybe->IsFailure()) return maybe; |
| 13392 ASSERT(!JSObject::cast(obj)->HasFastElements()); |
| 13393 } |
13387 } | 13394 } |
13388 return isolate->heap()->undefined_value(); | 13395 return isolate->heap()->undefined_value(); |
13389 } | 13396 } |
13390 | 13397 |
13391 | 13398 |
13392 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetObserverDeliveryPending) { | 13399 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetObserverDeliveryPending) { |
13393 ASSERT(args.length() == 0); | 13400 ASSERT(args.length() == 0); |
13394 isolate->set_observer_delivery_pending(true); | 13401 isolate->set_observer_delivery_pending(true); |
13395 return isolate->heap()->undefined_value(); | 13402 return isolate->heap()->undefined_value(); |
13396 } | 13403 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13515 // Handle last resort GC and make sure to allow future allocations | 13522 // Handle last resort GC and make sure to allow future allocations |
13516 // to grow the heap without causing GCs (if possible). | 13523 // to grow the heap without causing GCs (if possible). |
13517 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13524 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13518 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13525 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13519 "Runtime::PerformGC"); | 13526 "Runtime::PerformGC"); |
13520 } | 13527 } |
13521 } | 13528 } |
13522 | 13529 |
13523 | 13530 |
13524 } } // namespace v8::internal | 13531 } } // namespace v8::internal |
OLD | NEW |