Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: src/objects.cc

Issue 1125073004: Prevent stack overflow in the serializer/deserializer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixed all Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/bootstrapper.cc ('k') | src/snapshot/serialize.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 14671 matching lines...) Expand 10 before | Expand all | Expand 10 after
14682 14682
14683 14683
14684 template<typename Derived, typename Shape, typename Key> 14684 template<typename Derived, typename Shape, typename Key>
14685 Handle<Derived> HashTable<Derived, Shape, Key>::New( 14685 Handle<Derived> HashTable<Derived, Shape, Key>::New(
14686 Isolate* isolate, 14686 Isolate* isolate,
14687 int at_least_space_for, 14687 int at_least_space_for,
14688 MinimumCapacity capacity_option, 14688 MinimumCapacity capacity_option,
14689 PretenureFlag pretenure) { 14689 PretenureFlag pretenure) {
14690 DCHECK(0 <= at_least_space_for); 14690 DCHECK(0 <= at_least_space_for);
14691 DCHECK(!capacity_option || base::bits::IsPowerOfTwo32(at_least_space_for)); 14691 DCHECK(!capacity_option || base::bits::IsPowerOfTwo32(at_least_space_for));
14692 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY) 14692 int capacity =
14693 ? at_least_space_for 14693 (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY)
14694 : isolate->serializer_enabled() 14694 ? at_least_space_for
14695 ? ComputeCapacityForSerialization(at_least_space_for) 14695 : isolate->serializer_enabled() && isolate->bootstrapper()->IsActive()
14696 : ComputeCapacity(at_least_space_for); 14696 ? ComputeCapacityForSerialization(at_least_space_for)
14697 : ComputeCapacity(at_least_space_for);
14697 if (capacity > HashTable::kMaxCapacity) { 14698 if (capacity > HashTable::kMaxCapacity) {
14698 v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true); 14699 v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true);
14699 } 14700 }
14700 14701
14701 Factory* factory = isolate->factory(); 14702 Factory* factory = isolate->factory();
14702 int length = EntryToIndex(capacity); 14703 int length = EntryToIndex(capacity);
14703 Handle<FixedArray> array = factory->NewFixedArray(length, pretenure); 14704 Handle<FixedArray> array = factory->NewFixedArray(length, pretenure);
14704 array->set_map_no_write_barrier(*factory->hash_table_map()); 14705 array->set_map_no_write_barrier(*factory->hash_table_map());
14705 Handle<Derived> table = Handle<Derived>::cast(array); 14706 Handle<Derived> table = Handle<Derived>::cast(array);
14706 14707
(...skipping 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after
17245 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, 17246 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell,
17246 Handle<Object> new_value) { 17247 Handle<Object> new_value) {
17247 if (cell->value() != *new_value) { 17248 if (cell->value() != *new_value) {
17248 cell->set_value(*new_value); 17249 cell->set_value(*new_value);
17249 Isolate* isolate = cell->GetIsolate(); 17250 Isolate* isolate = cell->GetIsolate();
17250 cell->dependent_code()->DeoptimizeDependentCodeGroup( 17251 cell->dependent_code()->DeoptimizeDependentCodeGroup(
17251 isolate, DependentCode::kPropertyCellChangedGroup); 17252 isolate, DependentCode::kPropertyCellChangedGroup);
17252 } 17253 }
17253 } 17254 }
17254 } } // namespace v8::internal 17255 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/snapshot/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698