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

Unified Diff: src/liveedit.cc

Issue 11028027: Revert trunk to bleeding_edge at r12484 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 2 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
« no previous file with comments | « src/lithium.h ('k') | src/mark-compact.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/liveedit.cc
diff --git a/src/liveedit.cc b/src/liveedit.cc
index 2a3aafc1f1daa355d817f3d0031315844a4d748f..f35315438d7a4ef25200eed645b2469b34d9a09e 100644
--- a/src/liveedit.cc
+++ b/src/liveedit.cc
@@ -635,21 +635,6 @@ static Handle<JSValue> WrapInJSValue(Handle<Object> object) {
}
-static Handle<SharedFunctionInfo> UnwrapSharedFunctionInfoFromJSValue(
- Handle<JSValue> jsValue) {
- Object* shared = jsValue->value();
- CHECK(shared->IsSharedFunctionInfo());
- return Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(shared));
-}
-
-
-static int GetArrayLength(Handle<JSArray> array) {
- Object* length = array->length();
- CHECK(length->IsSmi());
- return Smi::cast(length)->value();
-}
-
-
// Simple helper class that creates more or less typed structures over
// JSArray object. This is an adhoc method of passing structures from C++
// to JavaScript.
@@ -792,7 +777,9 @@ class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> {
Object* element = this->GetField(kSharedInfoOffset_);
CHECK(element->IsJSValue());
Handle<JSValue> value_wrapper(JSValue::cast(element));
- return UnwrapSharedFunctionInfoFromJSValue(value_wrapper);
+ Handle<Object> raw_result = UnwrapJSValue(value_wrapper);
+ CHECK(raw_result->IsSharedFunctionInfo());
+ return Handle<SharedFunctionInfo>::cast(raw_result);
}
private:
@@ -928,7 +915,7 @@ JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script,
void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) {
HandleScope scope;
- int len = GetArrayLength(array);
+ int len = Smi::cast(array->length())->value();
for (int i = 0; i < len; i++) {
Handle<SharedFunctionInfo> info(
SharedFunctionInfo::cast(array->GetElementNoExceptionThrown(i)));
@@ -1145,7 +1132,7 @@ MaybeObject* LiveEdit::FunctionSourceUpdated(
void LiveEdit::SetFunctionScript(Handle<JSValue> function_wrapper,
Handle<Object> script_handle) {
Handle<SharedFunctionInfo> shared_info =
- UnwrapSharedFunctionInfoFromJSValue(function_wrapper);
+ Handle<SharedFunctionInfo>::cast(UnwrapJSValue(function_wrapper));
CHECK(script_handle->IsScript() || script_handle->IsUndefined());
shared_info->set_script(*script_handle);
@@ -1165,22 +1152,19 @@ void LiveEdit::SetFunctionScript(Handle<JSValue> function_wrapper,
static int TranslatePosition(int original_position,
Handle<JSArray> position_change_array) {
int position_diff = 0;
- int array_len = GetArrayLength(position_change_array);
+ int array_len = Smi::cast(position_change_array->length())->value();
// TODO(635): binary search may be used here
for (int i = 0; i < array_len; i += 3) {
Object* element = position_change_array->GetElementNoExceptionThrown(i);
- CHECK(element->IsSmi());
int chunk_start = Smi::cast(element)->value();
if (original_position < chunk_start) {
break;
}
element = position_change_array->GetElementNoExceptionThrown(i + 1);
- CHECK(element->IsSmi());
int chunk_end = Smi::cast(element)->value();
// Position mustn't be inside a chunk.
ASSERT(original_position >= chunk_end);
element = position_change_array->GetElementNoExceptionThrown(i + 2);
- CHECK(element->IsSmi());
int chunk_changed_end = Smi::cast(element)->value();
position_diff = chunk_changed_end - chunk_end;
}
@@ -1309,6 +1293,7 @@ static Handle<Code> PatchPositionsInCode(
MaybeObject* LiveEdit::PatchFunctionPositions(
Handle<JSArray> shared_info_array, Handle<JSArray> position_change_array) {
+
if (!SharedInfoWrapper::IsInstance(shared_info_array)) {
return Isolate::Current()->ThrowIllegalOperation();
}
@@ -1398,11 +1383,11 @@ void LiveEdit::ReplaceRefToNestedFunction(
Handle<JSValue> subst_function_wrapper) {
Handle<SharedFunctionInfo> parent_shared =
- UnwrapSharedFunctionInfoFromJSValue(parent_function_wrapper);
+ Handle<SharedFunctionInfo>::cast(UnwrapJSValue(parent_function_wrapper));
Handle<SharedFunctionInfo> orig_shared =
- UnwrapSharedFunctionInfoFromJSValue(orig_function_wrapper);
+ Handle<SharedFunctionInfo>::cast(UnwrapJSValue(orig_function_wrapper));
Handle<SharedFunctionInfo> subst_shared =
- UnwrapSharedFunctionInfoFromJSValue(subst_function_wrapper);
+ Handle<SharedFunctionInfo>::cast(UnwrapJSValue(subst_function_wrapper));
for (RelocIterator it(parent_shared->code()); !it.done(); it.next()) {
if (it.rinfo()->rmode() == RelocInfo::EMBEDDED_OBJECT) {
@@ -1425,13 +1410,12 @@ static bool CheckActivation(Handle<JSArray> shared_info_array,
Handle<JSFunction> function(
JSFunction::cast(JavaScriptFrame::cast(frame)->function()));
- int len = GetArrayLength(shared_info_array);
+ int len = Smi::cast(shared_info_array->length())->value();
for (int i = 0; i < len; i++) {
- Object* element = shared_info_array->GetElementNoExceptionThrown(i);
- CHECK(element->IsJSValue());
- Handle<JSValue> jsvalue(JSValue::cast(element));
- Handle<SharedFunctionInfo> shared =
- UnwrapSharedFunctionInfoFromJSValue(jsvalue);
+ JSValue* wrapper =
+ JSValue::cast(shared_info_array->GetElementNoExceptionThrown(i));
+ Handle<SharedFunctionInfo> shared(
+ SharedFunctionInfo::cast(wrapper->value()));
if (function->shared() == *shared || IsInlined(*function, *shared)) {
SetElementNonStrict(result, i, Handle<Smi>(Smi::FromInt(status)));
@@ -1739,7 +1723,7 @@ static const char* DropActivationsInActiveThread(
return message;
}
- int array_len = GetArrayLength(shared_info_array);
+ int array_len = Smi::cast(shared_info_array->length())->value();
// Replace "blocked on active" with "replaced on active" status.
for (int i = 0; i < array_len; i++) {
@@ -1781,7 +1765,7 @@ class InactiveThreadActivationsChecker : public ThreadVisitor {
Handle<JSArray> LiveEdit::CheckAndDropActivations(
Handle<JSArray> shared_info_array, bool do_drop, Zone* zone) {
- int len = GetArrayLength(shared_info_array);
+ int len = Smi::cast(shared_info_array->length())->value();
Handle<JSArray> result = FACTORY->NewJSArray(len);
« no previous file with comments | « src/lithium.h ('k') | src/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698