OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/extensions/externalize-string-extension.h" | 9 #include "src/extensions/externalize-string-extension.h" |
10 #include "src/extensions/free-buffer-extension.h" | 10 #include "src/extensions/free-buffer-extension.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 delete_these_non_arrays_on_tear_down_(NULL), | 41 delete_these_non_arrays_on_tear_down_(NULL), |
42 delete_these_arrays_on_tear_down_(NULL) { | 42 delete_these_arrays_on_tear_down_(NULL) { |
43 } | 43 } |
44 | 44 |
45 | 45 |
46 Handle<String> Bootstrapper::NativesSourceLookup(int index) { | 46 Handle<String> Bootstrapper::NativesSourceLookup(int index) { |
47 DCHECK(0 <= index && index < Natives::GetBuiltinsCount()); | 47 DCHECK(0 <= index && index < Natives::GetBuiltinsCount()); |
48 Heap* heap = isolate_->heap(); | 48 Heap* heap = isolate_->heap(); |
49 if (heap->natives_source_cache()->get(index)->IsUndefined()) { | 49 if (heap->natives_source_cache()->get(index)->IsUndefined()) { |
50 // We can use external strings for the natives. | 50 // We can use external strings for the natives. |
51 Vector<const char> source = Natives::GetRawScriptSource(index); | 51 Vector<const char> source = Natives::GetScriptSource(index); |
52 NativesExternalStringResource* resource = | 52 NativesExternalStringResource* resource = |
53 new NativesExternalStringResource(this, | 53 new NativesExternalStringResource(this, |
54 source.start(), | 54 source.start(), |
55 source.length()); | 55 source.length()); |
56 // We do not expect this to throw an exception. Change this if it does. | 56 // We do not expect this to throw an exception. Change this if it does. |
57 Handle<String> source_code = isolate_->factory() | 57 Handle<String> source_code = isolate_->factory() |
58 ->NewExternalStringFromOneByte(resource) | 58 ->NewExternalStringFromOneByte(resource) |
59 .ToHandleChecked(); | 59 .ToHandleChecked(); |
60 // Mark this external string with a special map. | 60 // Mark this external string with a special map. |
61 source_code->set_map(isolate_->heap()->native_source_string_map()); | 61 source_code->set_map(isolate_->heap()->native_source_string_map()); |
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 isolate->bootstrapper()->NativesSourceLookup(index); | 1387 isolate->bootstrapper()->NativesSourceLookup(index); |
1388 return CompileNative(isolate, name, source_code); | 1388 return CompileNative(isolate, name, source_code); |
1389 } | 1389 } |
1390 | 1390 |
1391 | 1391 |
1392 bool Genesis::CompileExperimentalBuiltin(Isolate* isolate, int index) { | 1392 bool Genesis::CompileExperimentalBuiltin(Isolate* isolate, int index) { |
1393 Vector<const char> name = ExperimentalNatives::GetScriptName(index); | 1393 Vector<const char> name = ExperimentalNatives::GetScriptName(index); |
1394 Factory* factory = isolate->factory(); | 1394 Factory* factory = isolate->factory(); |
1395 Handle<String> source_code; | 1395 Handle<String> source_code; |
1396 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 1396 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
1397 isolate, source_code, factory->NewStringFromAscii( | 1397 isolate, source_code, |
1398 ExperimentalNatives::GetRawScriptSource(index)), | 1398 factory->NewStringFromAscii(ExperimentalNatives::GetScriptSource(index)), |
1399 false); | 1399 false); |
1400 return CompileNative(isolate, name, source_code); | 1400 return CompileNative(isolate, name, source_code); |
1401 } | 1401 } |
1402 | 1402 |
1403 | 1403 |
1404 bool Genesis::CompileNative(Isolate* isolate, | 1404 bool Genesis::CompileNative(Isolate* isolate, |
1405 Vector<const char> name, | 1405 Vector<const char> name, |
1406 Handle<String> source) { | 1406 Handle<String> source) { |
1407 HandleScope scope(isolate); | 1407 HandleScope scope(isolate); |
1408 SuppressDebug compiling_natives(isolate->debug()); | 1408 SuppressDebug compiling_natives(isolate->debug()); |
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2819 return from + sizeof(NestingCounterType); | 2819 return from + sizeof(NestingCounterType); |
2820 } | 2820 } |
2821 | 2821 |
2822 | 2822 |
2823 // Called when the top-level V8 mutex is destroyed. | 2823 // Called when the top-level V8 mutex is destroyed. |
2824 void Bootstrapper::FreeThreadResources() { | 2824 void Bootstrapper::FreeThreadResources() { |
2825 DCHECK(!IsActive()); | 2825 DCHECK(!IsActive()); |
2826 } | 2826 } |
2827 | 2827 |
2828 } } // namespace v8::internal | 2828 } } // namespace v8::internal |
OLD | NEW |