| 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include "v8.h" | 7 #include "v8.h" |
| 8 | 8 |
| 9 #include "ast.h" | 9 #include "ast.h" |
| 10 #include "bootstrapper.h" | 10 #include "bootstrapper.h" |
| (...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 thread_manager_(NULL), | 1450 thread_manager_(NULL), |
| 1451 has_installed_extensions_(false), | 1451 has_installed_extensions_(false), |
| 1452 string_tracker_(NULL), | 1452 string_tracker_(NULL), |
| 1453 regexp_stack_(NULL), | 1453 regexp_stack_(NULL), |
| 1454 date_cache_(NULL), | 1454 date_cache_(NULL), |
| 1455 code_stub_interface_descriptors_(NULL), | 1455 code_stub_interface_descriptors_(NULL), |
| 1456 call_descriptors_(NULL), | 1456 call_descriptors_(NULL), |
| 1457 // TODO(bmeurer) Initialized lazily because it depends on flags; can | 1457 // TODO(bmeurer) Initialized lazily because it depends on flags; can |
| 1458 // be fixed once the default isolate cleanup is done. | 1458 // be fixed once the default isolate cleanup is done. |
| 1459 random_number_generator_(NULL), | 1459 random_number_generator_(NULL), |
| 1460 serializer_enabled_(false), |
| 1460 has_fatal_error_(false), | 1461 has_fatal_error_(false), |
| 1461 use_crankshaft_(true), | |
| 1462 initialized_from_snapshot_(false), | 1462 initialized_from_snapshot_(false), |
| 1463 cpu_profiler_(NULL), | 1463 cpu_profiler_(NULL), |
| 1464 heap_profiler_(NULL), | 1464 heap_profiler_(NULL), |
| 1465 function_entry_hook_(NULL), | 1465 function_entry_hook_(NULL), |
| 1466 deferred_handles_head_(NULL), | 1466 deferred_handles_head_(NULL), |
| 1467 optimizing_compiler_thread_(NULL), | 1467 optimizing_compiler_thread_(NULL), |
| 1468 sweeper_thread_(NULL), | 1468 sweeper_thread_(NULL), |
| 1469 num_sweeper_threads_(0), | 1469 num_sweeper_threads_(0), |
| 1470 stress_deopt_count_(0), | 1470 stress_deopt_count_(0), |
| 1471 next_optimization_id_(0) { | 1471 next_optimization_id_(0) { |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 | 1769 |
| 1770 | 1770 |
| 1771 bool Isolate::Init(Deserializer* des) { | 1771 bool Isolate::Init(Deserializer* des) { |
| 1772 ASSERT(state_ != INITIALIZED); | 1772 ASSERT(state_ != INITIALIZED); |
| 1773 TRACE_ISOLATE(init); | 1773 TRACE_ISOLATE(init); |
| 1774 | 1774 |
| 1775 stress_deopt_count_ = FLAG_deopt_every_n_times; | 1775 stress_deopt_count_ = FLAG_deopt_every_n_times; |
| 1776 | 1776 |
| 1777 has_fatal_error_ = false; | 1777 has_fatal_error_ = false; |
| 1778 | 1778 |
| 1779 use_crankshaft_ = FLAG_crankshaft | |
| 1780 && !Serializer::enabled(this) | |
| 1781 && CpuFeatures::SupportsCrankshaft(); | |
| 1782 | |
| 1783 if (function_entry_hook() != NULL) { | 1779 if (function_entry_hook() != NULL) { |
| 1784 // When function entry hooking is in effect, we have to create the code | 1780 // When function entry hooking is in effect, we have to create the code |
| 1785 // stubs from scratch to get entry hooks, rather than loading the previously | 1781 // stubs from scratch to get entry hooks, rather than loading the previously |
| 1786 // generated stubs from disk. | 1782 // generated stubs from disk. |
| 1787 // If this assert fires, the initialization path has regressed. | 1783 // If this assert fires, the initialization path has regressed. |
| 1788 ASSERT(des == NULL); | 1784 ASSERT(des == NULL); |
| 1789 } | 1785 } |
| 1790 | 1786 |
| 1791 // The initialization process does not handle memory exhaustion. | 1787 // The initialization process does not handle memory exhaustion. |
| 1792 DisallowAllocationFailure disallow_allocation_failure(this); | 1788 DisallowAllocationFailure disallow_allocation_failure(this); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1958 // Now that the heap is consistent, it's OK to generate the code for the | 1954 // Now that the heap is consistent, it's OK to generate the code for the |
| 1959 // deopt entry table that might have been referred to by optimized code in | 1955 // deopt entry table that might have been referred to by optimized code in |
| 1960 // the snapshot. | 1956 // the snapshot. |
| 1961 HandleScope scope(this); | 1957 HandleScope scope(this); |
| 1962 Deoptimizer::EnsureCodeForDeoptimizationEntry( | 1958 Deoptimizer::EnsureCodeForDeoptimizationEntry( |
| 1963 this, | 1959 this, |
| 1964 Deoptimizer::LAZY, | 1960 Deoptimizer::LAZY, |
| 1965 kDeoptTableSerializeEntryCount - 1); | 1961 kDeoptTableSerializeEntryCount - 1); |
| 1966 } | 1962 } |
| 1967 | 1963 |
| 1968 if (!Serializer::enabled(this)) { | 1964 if (!serializer_enabled()) { |
| 1969 // Ensure that all stubs which need to be generated ahead of time, but | 1965 // Ensure that all stubs which need to be generated ahead of time, but |
| 1970 // cannot be serialized into the snapshot have been generated. | 1966 // cannot be serialized into the snapshot have been generated. |
| 1971 HandleScope scope(this); | 1967 HandleScope scope(this); |
| 1972 CodeStub::GenerateFPStubs(this); | 1968 CodeStub::GenerateFPStubs(this); |
| 1973 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(this); | 1969 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(this); |
| 1974 StubFailureTrampolineStub::GenerateAheadOfTime(this); | 1970 StubFailureTrampolineStub::GenerateAheadOfTime(this); |
| 1975 // Ensure interface descriptors are initialized even when stubs have been | 1971 // Ensure interface descriptors are initialized even when stubs have been |
| 1976 // deserialized out of the snapshot without using the graph builder. | 1972 // deserialized out of the snapshot without using the graph builder. |
| 1977 FastCloneShallowArrayStub::InstallDescriptors(this); | 1973 FastCloneShallowArrayStub::InstallDescriptors(this); |
| 1978 BinaryOpICStub::InstallDescriptors(this); | 1974 BinaryOpICStub::InstallDescriptors(this); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2131 Object* maybe_transitioned_map = | 2127 Object* maybe_transitioned_map = |
| 2132 FixedArray::cast(maybe_map_array)->get(kind); | 2128 FixedArray::cast(maybe_map_array)->get(kind); |
| 2133 if (!maybe_transitioned_map->IsUndefined()) { | 2129 if (!maybe_transitioned_map->IsUndefined()) { |
| 2134 return Map::cast(maybe_transitioned_map); | 2130 return Map::cast(maybe_transitioned_map); |
| 2135 } | 2131 } |
| 2136 } | 2132 } |
| 2137 return NULL; | 2133 return NULL; |
| 2138 } | 2134 } |
| 2139 | 2135 |
| 2140 | 2136 |
| 2137 bool Isolate::use_crankshaft() const { |
| 2138 return FLAG_crankshaft && |
| 2139 !serializer_enabled_ && |
| 2140 CpuFeatures::SupportsCrankshaft(); |
| 2141 } |
| 2142 |
| 2143 |
| 2141 bool Isolate::IsFastArrayConstructorPrototypeChainIntact() { | 2144 bool Isolate::IsFastArrayConstructorPrototypeChainIntact() { |
| 2142 Map* root_array_map = | 2145 Map* root_array_map = |
| 2143 get_initial_js_array_map(GetInitialFastElementsKind()); | 2146 get_initial_js_array_map(GetInitialFastElementsKind()); |
| 2144 ASSERT(root_array_map != NULL); | 2147 ASSERT(root_array_map != NULL); |
| 2145 JSObject* initial_array_proto = JSObject::cast(*initial_array_prototype()); | 2148 JSObject* initial_array_proto = JSObject::cast(*initial_array_prototype()); |
| 2146 | 2149 |
| 2147 // Check that the array prototype hasn't been altered WRT empty elements. | 2150 // Check that the array prototype hasn't been altered WRT empty elements. |
| 2148 if (root_array_map->prototype() != initial_array_proto) return false; | 2151 if (root_array_map->prototype() != initial_array_proto) return false; |
| 2149 if (initial_array_proto->elements() != heap()->empty_fixed_array()) { | 2152 if (initial_array_proto->elements() != heap()->empty_fixed_array()) { |
| 2150 return false; | 2153 return false; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2285 Execution::Call(this, microtask, factory()->undefined_value(), | 2288 Execution::Call(this, microtask, factory()->undefined_value(), |
| 2286 0, NULL).Check(); | 2289 0, NULL).Check(); |
| 2287 } | 2290 } |
| 2288 } | 2291 } |
| 2289 | 2292 |
| 2290 handle_scope_implementer()->DecrementCallDepth(); | 2293 handle_scope_implementer()->DecrementCallDepth(); |
| 2291 } | 2294 } |
| 2292 | 2295 |
| 2293 | 2296 |
| 2294 } } // namespace v8::internal | 2297 } } // namespace v8::internal |
| OLD | NEW |