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

Issue 10836061: Change the zone allocation api. (Closed)

Created:
8 years, 4 months ago by turnidge
Modified:
6 years, 6 months ago
Reviewers:
cshapiro
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Change the zone allocation api. Instead of passing a size in bytes to the allocation function, we now have a templatized Alloc function: zone->Alloc<Type>(len) This is better for security, as we can check for integer overflow in the size computation before performing the allocation. Before, we often failed to check this. Committed: https://code.google.com/p/dart/source/detail?r=10254

Patch Set 1 #

Patch Set 2 : #

Total comments: 3

Patch Set 3 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+260 lines, -217 lines) Patch
M runtime/lib/regexp_jsc.cc View 1 2 2 chunks +2 lines, -4 lines 0 comments Download
M runtime/lib/string.cc View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M runtime/tests/vm/vm.status View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/allocation.cc View 1 2 1 chunk +4 lines, -1 line 0 comments Download
M runtime/vm/assembler.h View 1 2 5 chunks +7 lines, -7 lines 0 comments Download
M runtime/vm/assembler.cc View 1 2 4 chunks +11 lines, -7 lines 0 comments Download
M runtime/vm/bigint_operations_test.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/bit_vector.h View 1 2 1 chunk +1 line, -3 lines 0 comments Download
M runtime/vm/bitmap.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M runtime/vm/dart_api_impl.h View 1 2 2 chunks +3 lines, -8 lines 0 comments Download
M runtime/vm/dart_api_impl.cc View 1 2 14 chunks +20 lines, -40 lines 0 comments Download
M runtime/vm/dart_api_impl_test.cc View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M runtime/vm/dart_api_state.h View 1 2 1 chunk +21 lines, -7 lines 0 comments Download
M runtime/vm/debugger.cc View 1 2 2 chunks +2 lines, -4 lines 0 comments Download
M runtime/vm/double_conversion.cc View 1 2 3 chunks +3 lines, -6 lines 0 comments Download
M runtime/vm/flow_graph_builder.cc View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M runtime/vm/flow_graph_compiler.cc View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M runtime/vm/growable_array.h View 1 2 2 chunks +2 lines, -5 lines 0 comments Download
M runtime/vm/native_message_handler.cc View 1 2 1 chunk +4 lines, -4 lines 0 comments Download
M runtime/vm/object.cc View 1 2 31 chunks +38 lines, -60 lines 0 comments Download
M runtime/vm/raw_object_snapshot.cc View 1 2 4 chunks +6 lines, -5 lines 0 comments Download
M runtime/vm/snapshot_test.cc View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M runtime/vm/stack_frame_test.cc View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M runtime/vm/symbols.cc View 1 2 1 chunk +3 lines, -4 lines 0 comments Download
M runtime/vm/zone.h View 1 2 5 chunks +70 lines, -16 lines 0 comments Download
M runtime/vm/zone.cc View 1 2 2 chunks +2 lines, -14 lines 0 comments Download
M runtime/vm/zone_test.cc View 1 2 4 chunks +49 lines, -6 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
turnidge
8 years, 4 months ago (2012-08-01 22:05:55 UTC) #1
cshapiro
8 years, 4 months ago (2012-08-01 23:24:58 UTC) #2
lgtm

https://chromiumcodereview.appspot.com/10836061/diff/11003/runtime/vm/allocat...
File runtime/vm/allocation.cc (right):

https://chromiumcodereview.appspot.com/10836061/diff/11003/runtime/vm/allocat...
runtime/vm/allocation.cc:21: if (size > static_cast<uword>(kIntptrMax)) {
Why is this fatal?

https://chromiumcodereview.appspot.com/10836061/diff/11003/runtime/vm/allocat...
runtime/vm/allocation.cc:24: return
reinterpret_cast<void*>(isolate->current_zone()->AllocUnsafe(size));
Just curious: what is the behavior of new when there is an OOM in the native
heap?  Typically, an exception is thrown.  We have exceptions turned off, right?
 Are we guaranteed that the program will crash?  The callers do not check the
return value.

https://chromiumcodereview.appspot.com/10836061/diff/11003/runtime/vm/zone.h
File runtime/vm/zone.h (right):

https://chromiumcodereview.appspot.com/10836061/diff/11003/runtime/vm/zone.h#...
runtime/vm/zone.h:202: if (len > ((kIntptrMax - kAlignment) / element_size)) {
Why are we subtracting off the kAlignment here?  The underlying malloc may have
a different, and quite possibly larger, alignment constraint than kAlignment.

Powered by Google App Engine
This is Rietveld 408576698