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

Unified Diff: src/liveedit.cc

Issue 6621042: Ensure the result is used for the remaining calls to SetElement... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
« src/handles.h ('K') | « src/handles.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/liveedit.cc
===================================================================
--- src/liveedit.cc (revision 7070)
+++ src/liveedit.cc (working copy)
@@ -286,18 +286,22 @@
}
void WriteChunk(int char_pos1, int char_pos2, int char_len1, int char_len2) {
- SetElement(array_,
- current_size_,
- Handle<Object>(Smi::FromInt(char_pos1)),
- kNonStrictMode);
- SetElement(array_,
- current_size_ + 1,
- Handle<Object>(Smi::FromInt(char_pos1 + char_len1)),
- kNonStrictMode);
- SetElement(array_,
- current_size_ + 2,
- Handle<Object>(Smi::FromInt(char_pos2 + char_len2)),
- kNonStrictMode);
+ Handle<Object> no_failure;
+ no_failure = SetElement(array_,
Lasse Reichstein 2011/03/08 09:26:08 Add a comment saying that we never set element acc
+ current_size_,
+ Handle<Object>(Smi::FromInt(char_pos1)),
+ kNonStrictMode);
+ ASSERT(!no_failure.is_null());
+ no_failure = SetElement(array_,
+ current_size_ + 1,
+ Handle<Object>(Smi::FromInt(char_pos1 + char_len1)),
+ kNonStrictMode);
+ ASSERT(!no_failure.is_null());
+ no_failure = SetElement(array_,
+ current_size_ + 2,
+ Handle<Object>(Smi::FromInt(char_pos2 + char_len2)),
+ kNonStrictMode);
Lasse Reichstein 2011/03/08 09:26:08 Are we sure we don't get any warnings from this as
+ ASSERT(!no_failure.is_null());
current_size_ += 3;
}
@@ -552,13 +556,16 @@
protected:
void SetField(int field_position, Handle<Object> value) {
- SetElement(array_, field_position, value, kNonStrictMode);
+ Handle<Object> no_failure =
+ SetElement(array_, field_position, value, kNonStrictMode);
+ ASSERT(!no_failure.is_null());
}
void SetSmiValueField(int field_position, int value) {
- SetElement(array_,
- field_position,
- Handle<Smi>(Smi::FromInt(value)),
- kNonStrictMode);
+ Handle<Object> no_failure = SetElement(array_,
+ field_position,
+ Handle<Smi>(Smi::FromInt(value)),
+ kNonStrictMode);
+ ASSERT(!no_failure.is_null());
}
Object* GetField(int field_position) {
return array_->GetElementNoExceptionThrown(field_position);
@@ -697,7 +704,9 @@
fun->end_position(), fun->num_parameters(),
current_parent_index_);
current_parent_index_ = len_;
- SetElement(result_, len_, info.GetJSArray(), kNonStrictMode);
+ Handle<Object> no_failure =
+ SetElement(result_, len_, info.GetJSArray(), kNonStrictMode);
+ ASSERT(!no_failure.is_null());
len_++;
}
@@ -776,17 +785,25 @@
}
list[k] = list[l];
}
+ Handle<Object> no_failure;
for (int i = 0; i < j; i++) {
- SetElement(scope_info_list, scope_info_length,
- list[i]->name(), kNonStrictMode);
+ no_failure = SetElement(scope_info_list, scope_info_length,
+ list[i]->name(), kNonStrictMode);
+ ASSERT(!no_failure.is_null());
scope_info_length++;
- SetElement(scope_info_list, scope_info_length,
- Handle<Smi>(Smi::FromInt(list[i]->AsSlot()->index())),
- kNonStrictMode);
+ no_failure = SetElement(
+ scope_info_list,
+ scope_info_length,
+ Handle<Smi>(Smi::FromInt(list[i]->AsSlot()->index())),
+ kNonStrictMode);
+ ASSERT(!no_failure.is_null());
scope_info_length++;
}
- SetElement(scope_info_list, scope_info_length,
- Handle<Object>(Heap::null_value()), kNonStrictMode);
+ no_failure = SetElement(scope_info_list,
+ scope_info_length,
+ Handle<Object>(Heap::null_value()),
+ kNonStrictMode);
+ ASSERT(!no_failure.is_null());
scope_info_length++;
outer_scope = outer_scope->outer_scope();
@@ -829,7 +846,9 @@
Handle<String> name_handle(String::cast(info->name()));
info_wrapper.SetProperties(name_handle, info->start_position(),
info->end_position(), info);
- SetElement(array, i, info_wrapper.GetJSArray(), kNonStrictMode);
+ Handle<Object> no_failure =
+ SetElement(array, i, info_wrapper.GetJSArray(), kNonStrictMode);
+ ASSERT(!no_failure.is_null());
}
}
@@ -1327,7 +1346,12 @@
SharedFunctionInfo::cast(wrapper->value()));
if (function->shared() == *shared || IsInlined(*function, *shared)) {
- SetElement(result, i, Handle<Smi>(Smi::FromInt(status)), kNonStrictMode);
+ Handle<Object> no_failure =
+ SetElement(result,
+ i,
+ Handle<Smi>(Smi::FromInt(status)),
+ kNonStrictMode);
+ ASSERT(!no_failure.is_null());
return true;
}
}
@@ -1532,7 +1556,9 @@
Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) {
Handle<Object> replaced(
Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK));
- SetElement(result, i, replaced, kNonStrictMode);
+ Handle<Object> no_failure =
+ SetElement(result, i, replaced, kNonStrictMode);
+ ASSERT(!no_failure.is_null());
}
}
return NULL;
@@ -1572,9 +1598,11 @@
// Fill the default values.
for (int i = 0; i < len; i++) {
- SetElement(result, i,
- Handle<Smi>(Smi::FromInt(FUNCTION_AVAILABLE_FOR_PATCH)),
- kNonStrictMode);
+ Handle<Object> no_failure =
+ SetElement(result, i,
+ Handle<Smi>(Smi::FromInt(FUNCTION_AVAILABLE_FOR_PATCH)),
+ kNonStrictMode);
+ ASSERT(!no_failure.is_null());
}
@@ -1593,7 +1621,8 @@
// Add error message as an array extra element.
Vector<const char> vector_message(error_message, StrLength(error_message));
Handle<String> str = Factory::NewStringFromAscii(vector_message);
- SetElement(result, len, str, kNonStrictMode);
+ Handle<Object> no_failure = SetElement(result, len, str, kNonStrictMode);
+ ASSERT(!no_failure.is_null());
}
return result;
}
« src/handles.h ('K') | « src/handles.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698