Chromium Code Reviews| 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/factory.h" | 5 #include "src/factory.h" |
| 6 | 6 |
| 7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 793 array->set_map_no_write_barrier(*catch_context_map()); | 793 array->set_map_no_write_barrier(*catch_context_map()); |
| 794 Handle<Context> context = Handle<Context>::cast(array); | 794 Handle<Context> context = Handle<Context>::cast(array); |
| 795 context->set_closure(*function); | 795 context->set_closure(*function); |
| 796 context->set_previous(*previous); | 796 context->set_previous(*previous); |
| 797 context->set_extension(*name); | 797 context->set_extension(*name); |
| 798 context->set_native_context(previous->native_context()); | 798 context->set_native_context(previous->native_context()); |
| 799 context->set(Context::THROWN_OBJECT_INDEX, *thrown_object); | 799 context->set(Context::THROWN_OBJECT_INDEX, *thrown_object); |
| 800 return context; | 800 return context; |
| 801 } | 801 } |
| 802 | 802 |
| 803 Handle<Context> Factory::NewDebugEvaluateContext( | |
| 804 Handle<Context> previous, Handle<JSReceiver> extension, | |
| 805 Handle<Context> wrapped, Handle<NameDictionary> whitelist) { | |
| 806 STATIC_ASSERT(Context::WHITE_LIST_INDEX == Context::MIN_CONTEXT_SLOTS + 1); | |
| 807 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS + 2); | |
| 808 array->set_map_no_write_barrier(*debug_evaluate_context_map()); | |
| 809 Handle<Context> context = Handle<Context>::cast(array); | |
| 810 context->set_closure(wrapped.is_null() ? previous->closure() | |
| 811 : wrapped->closure()); | |
| 812 context->set_previous(*previous); | |
| 813 context->set_native_context(previous->native_context()); | |
| 814 context->set(Context::EXTENSION_INDEX, | |
| 815 extension.is_null() ? NULL : *extension); | |
|
Camillo Bruni
2016/03/30 22:54:51
nit: should probably use nullptr here
| |
| 816 context->set(Context::WRAPPED_CONTEXT_INDEX, | |
| 817 wrapped.is_null() ? NULL : *wrapped); | |
| 818 context->set(Context::WHITE_LIST_INDEX, | |
| 819 whitelist.is_null() ? NULL : *whitelist); | |
| 820 return context; | |
| 821 } | |
| 803 | 822 |
| 804 Handle<Context> Factory::NewWithContext(Handle<JSFunction> function, | 823 Handle<Context> Factory::NewWithContext(Handle<JSFunction> function, |
| 805 Handle<Context> previous, | 824 Handle<Context> previous, |
| 806 Handle<JSReceiver> extension) { | 825 Handle<JSReceiver> extension) { |
| 807 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS); | 826 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS); |
| 808 array->set_map_no_write_barrier(*with_context_map()); | 827 array->set_map_no_write_barrier(*with_context_map()); |
| 809 Handle<Context> context = Handle<Context>::cast(array); | 828 Handle<Context> context = Handle<Context>::cast(array); |
| 810 context->set_closure(*function); | 829 context->set_closure(*function); |
| 811 context->set_previous(*previous); | 830 context->set_previous(*previous); |
| 812 context->set_extension(*extension); | 831 context->set_extension(*extension); |
| (...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2355 } | 2374 } |
| 2356 | 2375 |
| 2357 | 2376 |
| 2358 Handle<Object> Factory::ToBoolean(bool value) { | 2377 Handle<Object> Factory::ToBoolean(bool value) { |
| 2359 return value ? true_value() : false_value(); | 2378 return value ? true_value() : false_value(); |
| 2360 } | 2379 } |
| 2361 | 2380 |
| 2362 | 2381 |
| 2363 } // namespace internal | 2382 } // namespace internal |
| 2364 } // namespace v8 | 2383 } // namespace v8 |
| OLD | NEW |