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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 719 return symbol; | 719 return symbol; |
| 720 } | 720 } |
| 721 | 721 |
| 722 | 722 |
| 723 Handle<Context> Factory::NewNativeContext() { | 723 Handle<Context> Factory::NewNativeContext() { |
| 724 Handle<FixedArray> array = | 724 Handle<FixedArray> array = |
| 725 NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED); | 725 NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED); |
| 726 array->set_map_no_write_barrier(*native_context_map()); | 726 array->set_map_no_write_barrier(*native_context_map()); |
| 727 Handle<Context> context = Handle<Context>::cast(array); | 727 Handle<Context> context = Handle<Context>::cast(array); |
| 728 context->set_js_array_maps(*undefined_value()); | 728 context->set_js_array_maps(*undefined_value()); |
| 729 // Initialize with -1 because the value is incremented once | |
| 730 // during the build. This means the value is correctly initialized to | |
| 731 // 0 afterwards. | |
| 732 context->set_errors_thrown(Smi::FromInt(-1)); | |
|
Yang
2015/11/02 05:48:57
This seems somewhat brittle.
Could we move this l
Michael Hablich
2015/11/04 10:58:08
Thanks for the remark. I left the initialization i
| |
| 729 DCHECK(context->IsNativeContext()); | 733 DCHECK(context->IsNativeContext()); |
| 730 return context; | 734 return context; |
| 731 } | 735 } |
| 732 | 736 |
| 733 | 737 |
| 734 Handle<Context> Factory::NewScriptContext(Handle<JSFunction> function, | 738 Handle<Context> Factory::NewScriptContext(Handle<JSFunction> function, |
| 735 Handle<ScopeInfo> scope_info) { | 739 Handle<ScopeInfo> scope_info) { |
| 736 Handle<FixedArray> array = | 740 Handle<FixedArray> array = |
| 737 NewFixedArray(scope_info->ContextLength(), TENURED); | 741 NewFixedArray(scope_info->ContextLength(), TENURED); |
| 738 array->set_map_no_write_barrier(*script_context_map()); | 742 array->set_map_no_write_barrier(*script_context_map()); |
| (...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2389 } | 2393 } |
| 2390 | 2394 |
| 2391 | 2395 |
| 2392 Handle<Object> Factory::ToBoolean(bool value) { | 2396 Handle<Object> Factory::ToBoolean(bool value) { |
| 2393 return value ? true_value() : false_value(); | 2397 return value ? true_value() : false_value(); |
| 2394 } | 2398 } |
| 2395 | 2399 |
| 2396 | 2400 |
| 2397 } // namespace internal | 2401 } // namespace internal |
| 2398 } // namespace v8 | 2402 } // namespace v8 |
| OLD | NEW |