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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 341 |
342 | 342 |
343 MaybeObject* TransitionElements(Handle<Object> object, | 343 MaybeObject* TransitionElements(Handle<Object> object, |
344 ElementsKind to_kind, | 344 ElementsKind to_kind, |
345 Isolate* isolate) { | 345 Isolate* isolate) { |
346 HandleScope scope(isolate); | 346 HandleScope scope(isolate); |
347 if (!object->IsJSObject()) return isolate->ThrowIllegalOperation(); | 347 if (!object->IsJSObject()) return isolate->ThrowIllegalOperation(); |
348 ElementsKind from_kind = | 348 ElementsKind from_kind = |
349 Handle<JSObject>::cast(object)->map()->elements_kind(); | 349 Handle<JSObject>::cast(object)->map()->elements_kind(); |
350 if (Map::IsValidElementsTransition(from_kind, to_kind)) { | 350 if (Map::IsValidElementsTransition(from_kind, to_kind)) { |
351 Handle<Object> result = JSObject::TransitionElementsKind( | 351 JSObject::TransitionElementsKind(Handle<JSObject>::cast(object), to_kind); |
352 Handle<JSObject>::cast(object), to_kind); | 352 return *object; |
353 if (result.is_null()) return isolate->ThrowIllegalOperation(); | |
354 return *result; | |
355 } | 353 } |
356 return isolate->ThrowIllegalOperation(); | 354 return isolate->ThrowIllegalOperation(); |
357 } | 355 } |
358 | 356 |
359 | 357 |
360 static const int kSmiLiteralMinimumLength = 1024; | 358 static const int kSmiLiteralMinimumLength = 1024; |
361 | 359 |
362 | 360 |
363 Handle<Object> Runtime::CreateArrayLiteralBoilerplate( | 361 Handle<Object> Runtime::CreateArrayLiteralBoilerplate( |
364 Isolate* isolate, | 362 Isolate* isolate, |
(...skipping 14433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14798 // Handle last resort GC and make sure to allow future allocations | 14796 // Handle last resort GC and make sure to allow future allocations |
14799 // to grow the heap without causing GCs (if possible). | 14797 // to grow the heap without causing GCs (if possible). |
14800 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14798 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14801 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14799 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14802 "Runtime::PerformGC"); | 14800 "Runtime::PerformGC"); |
14803 } | 14801 } |
14804 } | 14802 } |
14805 | 14803 |
14806 | 14804 |
14807 } } // namespace v8::internal | 14805 } } // namespace v8::internal |
OLD | NEW |