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 |
11 #include <cmath> // For isnan. | 11 #include <cmath> // For isnan. |
12 #include "include/v8-debug.h" | 12 #include "include/v8-debug.h" |
13 #include "include/v8-profiler.h" | 13 #include "include/v8-profiler.h" |
14 #include "include/v8-testing.h" | 14 #include "include/v8-testing.h" |
15 #include "src/api-natives.h" | 15 #include "src/api-natives.h" |
16 #include "src/assert-scope.h" | 16 #include "src/assert-scope.h" |
17 #include "src/background-parsing-task.h" | 17 #include "src/background-parsing-task.h" |
18 #include "src/base/functional.h" | 18 #include "src/base/functional.h" |
19 #include "src/base/platform/platform.h" | 19 #include "src/base/platform/platform.h" |
20 #include "src/base/platform/time.h" | 20 #include "src/base/platform/time.h" |
21 #include "src/base/utils/random-number-generator.h" | 21 #include "src/base/utils/random-number-generator.h" |
22 #include "src/bootstrapper.h" | 22 #include "src/bootstrapper.h" |
23 #include "src/code-stubs.h" | 23 #include "src/code-stubs.h" |
24 #include "src/compiler.h" | 24 #include "src/compiler.h" |
| 25 #include "src/context-measure.h" |
25 #include "src/contexts.h" | 26 #include "src/contexts.h" |
26 #include "src/conversions-inl.h" | 27 #include "src/conversions-inl.h" |
27 #include "src/counters.h" | 28 #include "src/counters.h" |
28 #include "src/cpu-profiler.h" | 29 #include "src/cpu-profiler.h" |
29 #include "src/debug/debug.h" | 30 #include "src/debug/debug.h" |
30 #include "src/deoptimizer.h" | 31 #include "src/deoptimizer.h" |
31 #include "src/execution.h" | 32 #include "src/execution.h" |
32 #include "src/global-handles.h" | 33 #include "src/global-handles.h" |
33 #include "src/heap/spaces.h" | 34 #include "src/heap/spaces.h" |
34 #include "src/heap-profiler.h" | 35 #include "src/heap-profiler.h" |
(...skipping 5535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5570 } | 5571 } |
5571 | 5572 |
5572 | 5573 |
5573 void Context::SetErrorMessageForCodeGenerationFromStrings(Local<String> error) { | 5574 void Context::SetErrorMessageForCodeGenerationFromStrings(Local<String> error) { |
5574 i::Handle<i::Context> context = Utils::OpenHandle(this); | 5575 i::Handle<i::Context> context = Utils::OpenHandle(this); |
5575 i::Handle<i::String> error_handle = Utils::OpenHandle(*error); | 5576 i::Handle<i::String> error_handle = Utils::OpenHandle(*error); |
5576 context->set_error_message_for_code_gen_from_strings(*error_handle); | 5577 context->set_error_message_for_code_gen_from_strings(*error_handle); |
5577 } | 5578 } |
5578 | 5579 |
5579 | 5580 |
| 5581 size_t Context::EstimatedSize() { |
| 5582 return static_cast<size_t>( |
| 5583 i::ContextMeasure(*Utils::OpenHandle(this)).Size()); |
| 5584 } |
| 5585 |
| 5586 |
5580 MaybeLocal<v8::Object> ObjectTemplate::NewInstance(Local<Context> context) { | 5587 MaybeLocal<v8::Object> ObjectTemplate::NewInstance(Local<Context> context) { |
5581 PREPARE_FOR_EXECUTION(context, "v8::ObjectTemplate::NewInstance()", Object); | 5588 PREPARE_FOR_EXECUTION(context, "v8::ObjectTemplate::NewInstance()", Object); |
5582 auto self = Utils::OpenHandle(this); | 5589 auto self = Utils::OpenHandle(this); |
5583 Local<Object> result; | 5590 Local<Object> result; |
5584 has_pending_exception = | 5591 has_pending_exception = |
5585 !ToLocal<Object>(i::ApiNatives::InstantiateObject(self), &result); | 5592 !ToLocal<Object>(i::ApiNatives::InstantiateObject(self), &result); |
5586 RETURN_ON_FAILED_EXECUTION(Object); | 5593 RETURN_ON_FAILED_EXECUTION(Object); |
5587 RETURN_ESCAPED(result); | 5594 RETURN_ESCAPED(result); |
5588 } | 5595 } |
5589 | 5596 |
(...skipping 2815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8405 Address callback_address = | 8412 Address callback_address = |
8406 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8413 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8407 VMState<EXTERNAL> state(isolate); | 8414 VMState<EXTERNAL> state(isolate); |
8408 ExternalCallbackScope call_scope(isolate, callback_address); | 8415 ExternalCallbackScope call_scope(isolate, callback_address); |
8409 callback(info); | 8416 callback(info); |
8410 } | 8417 } |
8411 | 8418 |
8412 | 8419 |
8413 } // namespace internal | 8420 } // namespace internal |
8414 } // namespace v8 | 8421 } // namespace v8 |
OLD | NEW |