Index: src/json-stringifier.h |
diff --git a/src/json-stringifier.h b/src/json-stringifier.h |
index a75b3deed50eacb0863ef2eed4957302674e3ac6..012094aee8f3aef16121f14d97d2af0d56dfd78c 100644 |
--- a/src/json-stringifier.h |
+++ b/src/json-stringifier.h |
@@ -390,13 +390,16 @@ BasicJsonStringifier::Result BasicJsonStringifier::StackPush( |
if (check.HasOverflowed()) return STACK_OVERFLOW; |
int length = Smi::cast(stack_->length())->value(); |
- FixedArray* elements = FixedArray::cast(stack_->elements()); |
- for (int i = 0; i < length; i++) { |
- if (elements->get(i) == *object) { |
- return CIRCULAR; |
+ { |
+ DisallowHeapAllocation no_allocation; |
+ FixedArray* elements = FixedArray::cast(stack_->elements()); |
+ for (int i = 0; i < length; i++) { |
+ if (elements->get(i) == *object) { |
+ return CIRCULAR; |
+ } |
} |
} |
- stack_->EnsureSize(length + 1); |
+ JSArray::EnsureSize(stack_, length + 1); |
FixedArray::cast(stack_->elements())->set(length, *object); |
stack_->set_length(Smi::FromInt(length + 1)); |
return SUCCESS; |