OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 | 1530 |
1531 | 1531 |
1532 // --- S c r i p t s --- | 1532 // --- S c r i p t s --- |
1533 | 1533 |
1534 | 1534 |
1535 // Internally, UnboundScript is a SharedFunctionInfo, and Script is a | 1535 // Internally, UnboundScript is a SharedFunctionInfo, and Script is a |
1536 // JSFunction. | 1536 // JSFunction. |
1537 | 1537 |
1538 ScriptCompiler::CachedData::CachedData(const uint8_t* data_, int length_, | 1538 ScriptCompiler::CachedData::CachedData(const uint8_t* data_, int length_, |
1539 BufferPolicy buffer_policy_) | 1539 BufferPolicy buffer_policy_) |
1540 : data(data_), length(length_), buffer_policy(buffer_policy_) {} | 1540 : data(data_), |
| 1541 length(length_), |
| 1542 rejected(false), |
| 1543 buffer_policy(buffer_policy_) {} |
1541 | 1544 |
1542 | 1545 |
1543 ScriptCompiler::CachedData::~CachedData() { | 1546 ScriptCompiler::CachedData::~CachedData() { |
1544 if (buffer_policy == BufferOwned) { | 1547 if (buffer_policy == BufferOwned) { |
1545 delete[] data; | 1548 delete[] data; |
1546 } | 1549 } |
1547 } | 1550 } |
1548 | 1551 |
1549 | 1552 |
1550 ScriptCompiler::StreamedSource::StreamedSource(ExternalSourceStream* stream, | 1553 ScriptCompiler::StreamedSource::StreamedSource(ExternalSourceStream* stream, |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 EXCEPTION_BAILOUT_CHECK(isolate, Local<UnboundScript>()); | 1749 EXCEPTION_BAILOUT_CHECK(isolate, Local<UnboundScript>()); |
1747 raw_result = *result; | 1750 raw_result = *result; |
1748 | 1751 |
1749 if ((options == kProduceParserCache || options == kProduceCodeCache) && | 1752 if ((options == kProduceParserCache || options == kProduceCodeCache) && |
1750 script_data != NULL) { | 1753 script_data != NULL) { |
1751 // script_data now contains the data that was generated. source will | 1754 // script_data now contains the data that was generated. source will |
1752 // take the ownership. | 1755 // take the ownership. |
1753 source->cached_data = new CachedData( | 1756 source->cached_data = new CachedData( |
1754 script_data->data(), script_data->length(), CachedData::BufferOwned); | 1757 script_data->data(), script_data->length(), CachedData::BufferOwned); |
1755 script_data->ReleaseDataOwnership(); | 1758 script_data->ReleaseDataOwnership(); |
| 1759 } else if (options == kConsumeParserCache || options == kConsumeCodeCache) { |
| 1760 source->cached_data->rejected = script_data->rejected(); |
1756 } | 1761 } |
1757 delete script_data; | 1762 delete script_data; |
1758 } | 1763 } |
1759 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); | 1764 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); |
1760 return ToApiHandle<UnboundScript>(result); | 1765 return ToApiHandle<UnboundScript>(result); |
1761 } | 1766 } |
1762 | 1767 |
1763 | 1768 |
1764 Local<Script> ScriptCompiler::Compile( | 1769 Local<Script> ScriptCompiler::Compile( |
1765 Isolate* v8_isolate, | 1770 Isolate* v8_isolate, |
(...skipping 6012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7778 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7783 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7779 Address callback_address = | 7784 Address callback_address = |
7780 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7785 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7781 VMState<EXTERNAL> state(isolate); | 7786 VMState<EXTERNAL> state(isolate); |
7782 ExternalCallbackScope call_scope(isolate, callback_address); | 7787 ExternalCallbackScope call_scope(isolate, callback_address); |
7783 callback(info); | 7788 callback(info); |
7784 } | 7789 } |
7785 | 7790 |
7786 | 7791 |
7787 } } // namespace v8::internal | 7792 } } // namespace v8::internal |
OLD | NEW |