| 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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) { | 642 RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) { |
| 643 NoHandleAllocation ha(isolate); | 643 NoHandleAllocation ha(isolate); |
| 644 ASSERT(args.length() == 1); | 644 ASSERT(args.length() == 1); |
| 645 CONVERT_ARG_CHECKED(JSProxy, proxy, 0); | 645 CONVERT_ARG_CHECKED(JSProxy, proxy, 0); |
| 646 proxy->Fix(); | 646 proxy->Fix(); |
| 647 return isolate->heap()->undefined_value(); | 647 return isolate->heap()->undefined_value(); |
| 648 } | 648 } |
| 649 | 649 |
| 650 | 650 |
| 651 static void ArrayBufferWeakCallback(v8::Isolate* external_isolate, | 651 static void ArrayBufferWeakCallback(v8::Isolate* external_isolate, |
| 652 Persistent<Value> object, | 652 Persistent<Value>* object, |
| 653 void* data) { | 653 void* data) { |
| 654 Isolate* isolate = reinterpret_cast<Isolate*>(external_isolate); | 654 Isolate* isolate = reinterpret_cast<Isolate*>(external_isolate); |
| 655 HandleScope scope(isolate); | 655 HandleScope scope(isolate); |
| 656 Handle<Object> internal_object = Utils::OpenHandle(*object); | 656 Handle<Object> internal_object = Utils::OpenHandle(**object); |
| 657 | 657 |
| 658 size_t allocated_length = NumberToSize( | 658 size_t allocated_length = NumberToSize( |
| 659 isolate, JSArrayBuffer::cast(*internal_object)->byte_length()); | 659 isolate, JSArrayBuffer::cast(*internal_object)->byte_length()); |
| 660 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( | 660 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( |
| 661 -static_cast<intptr_t>(allocated_length)); | 661 -static_cast<intptr_t>(allocated_length)); |
| 662 if (data != NULL) | 662 if (data != NULL) |
| 663 free(data); | 663 free(data); |
| 664 object.Dispose(external_isolate); | 664 object->Dispose(external_isolate); |
| 665 } | 665 } |
| 666 | 666 |
| 667 | 667 |
| 668 bool Runtime::SetupArrayBuffer(Isolate* isolate, | 668 bool Runtime::SetupArrayBuffer(Isolate* isolate, |
| 669 Handle<JSArrayBuffer> array_buffer, | 669 Handle<JSArrayBuffer> array_buffer, |
| 670 void* data, | 670 void* data, |
| 671 size_t allocated_length) { | 671 size_t allocated_length) { |
| 672 array_buffer->set_backing_store(data); | 672 array_buffer->set_backing_store(data); |
| 673 | 673 |
| 674 Handle<Object> byte_length = | 674 Handle<Object> byte_length = |
| (...skipping 12706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13381 // Handle last resort GC and make sure to allow future allocations | 13381 // Handle last resort GC and make sure to allow future allocations |
| 13382 // to grow the heap without causing GCs (if possible). | 13382 // to grow the heap without causing GCs (if possible). |
| 13383 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13383 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13384 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13384 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13385 "Runtime::PerformGC"); | 13385 "Runtime::PerformGC"); |
| 13386 } | 13386 } |
| 13387 } | 13387 } |
| 13388 | 13388 |
| 13389 | 13389 |
| 13390 } } // namespace v8::internal | 13390 } } // namespace v8::internal |
| OLD | NEW |