Commit 574cfbcc authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Introduce DisallowDeoptimization scope.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/254763007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20998 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b922b0dd
......@@ -50,7 +50,8 @@ enum PerThreadAssertType {
enum PerIsolateAssertType {
JAVASCRIPT_EXECUTION_ASSERT,
JAVASCRIPT_EXECUTION_THROWS,
ALLOCATION_FAILURE_ASSERT
ALLOCATION_FAILURE_ASSERT,
DEOPTIMIZATION_ASSERT
};
......@@ -268,6 +269,14 @@ typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, false>
typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, true>
AllowAllocationFailure;
// Scope to document where we do not expect deoptimization.
typedef PerIsolateAssertScopeDebugOnly<DEOPTIMIZATION_ASSERT, false>
DisallowDeoptimization;
// Scope to introduce an exception to DisallowDeoptimization.
typedef PerIsolateAssertScopeDebugOnly<DEOPTIMIZATION_ASSERT, true>
AllowDeoptimization;
} } // namespace v8::internal
#endif // V8_ASSERT_SCOPE_H_
......@@ -4679,6 +4679,7 @@ bool Code::marked_for_deoptimization() {
void Code::set_marked_for_deoptimization(bool flag) {
ASSERT(kind() == OPTIMIZED_FUNCTION);
ASSERT(!flag || AllowDeoptimization::IsAllowed(GetIsolate()));
int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
int updated = MarkedForDeoptimizationField::update(previous, flag);
WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
......
......@@ -2781,6 +2781,7 @@ MaybeHandle<Map> Map::CurrentMapForDeprecated(Handle<Map> map) {
// static
MaybeHandle<Map> Map::CurrentMapForDeprecatedInternal(Handle<Map> old_map) {
DisallowHeapAllocation no_allocation;
DisallowDeoptimization no_deoptimization(old_map->GetIsolate());
if (!old_map->is_deprecated()) return old_map;
......@@ -3940,7 +3941,9 @@ void JSObject::MigrateInstance(Handle<JSObject> object) {
// static
bool JSObject::TryMigrateInstance(Handle<JSObject> object) {
Handle<Map> original_map(object->map());
Isolate* isolate = object->GetIsolate();
DisallowDeoptimization no_deoptimization(isolate);
Handle<Map> original_map(object->map(), isolate);
Handle<Map> new_map;
if (!Map::CurrentMapForDeprecatedInternal(original_map).ToHandle(&new_map)) {
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment