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 10 matching lines...) Expand all Loading... |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 #include <limits> | 29 #include <limits> |
30 | 30 |
31 #define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT | |
32 | |
33 #include "v8.h" | 31 #include "v8.h" |
34 | 32 |
35 #include "accessors.h" | 33 #include "accessors.h" |
36 #include "api.h" | 34 #include "api.h" |
37 #include "arguments.h" | 35 #include "arguments.h" |
38 #include "bootstrapper.h" | 36 #include "bootstrapper.h" |
39 #include "codegen.h" | 37 #include "codegen.h" |
40 #include "compilation-cache.h" | 38 #include "compilation-cache.h" |
41 #include "compiler.h" | 39 #include "compiler.h" |
42 #include "cpu.h" | 40 #include "cpu.h" |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 data = malloc(allocated_length); | 699 data = malloc(allocated_length); |
702 if (data == NULL) return false; | 700 if (data == NULL) return false; |
703 memset(data, 0, allocated_length); | 701 memset(data, 0, allocated_length); |
704 } else { | 702 } else { |
705 data = NULL; | 703 data = NULL; |
706 } | 704 } |
707 | 705 |
708 SetupArrayBuffer(isolate, array_buffer, false, data, allocated_length); | 706 SetupArrayBuffer(isolate, array_buffer, false, data, allocated_length); |
709 | 707 |
710 v8::Isolate* external_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 708 v8::Isolate* external_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
711 v8::Persistent<v8::Value> weak_handle = v8::Persistent<v8::Value>::New( | 709 v8::Persistent<v8::Value> weak_handle( |
712 external_isolate, v8::Utils::ToLocal(Handle<Object>::cast(array_buffer))); | 710 external_isolate, v8::Utils::ToLocal(Handle<Object>::cast(array_buffer))); |
713 weak_handle.MakeWeak(external_isolate, data, ArrayBufferWeakCallback); | 711 weak_handle.MakeWeak(external_isolate, data, ArrayBufferWeakCallback); |
714 weak_handle.MarkIndependent(external_isolate); | 712 weak_handle.MarkIndependent(external_isolate); |
715 isolate->heap()->AdjustAmountOfExternalAllocatedMemory(allocated_length); | 713 isolate->heap()->AdjustAmountOfExternalAllocatedMemory(allocated_length); |
716 | 714 |
717 return true; | 715 return true; |
718 } | 716 } |
719 | 717 |
720 | 718 |
721 RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferInitialize) { | 719 RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferInitialize) { |
(...skipping 12800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13522 // Handle last resort GC and make sure to allow future allocations | 13520 // Handle last resort GC and make sure to allow future allocations |
13523 // to grow the heap without causing GCs (if possible). | 13521 // to grow the heap without causing GCs (if possible). |
13524 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13522 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13525 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13523 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13526 "Runtime::PerformGC"); | 13524 "Runtime::PerformGC"); |
13527 } | 13525 } |
13528 } | 13526 } |
13529 | 13527 |
13530 | 13528 |
13531 } } // namespace v8::internal | 13529 } } // namespace v8::internal |
OLD | NEW |