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

Unified Diff: src/liveedit.cc

Issue 1687022: Make LiveEdit natives fuzzy (Closed)
Patch Set: uncomment code Created 10 years, 8 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/liveedit.h ('k') | src/runtime.cc » ('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 cf49bf7697049ac3a09b9cf447f76a50a3ed3fce..592ef4990616b9ddaf3138a591a1aa8f28906a0e 100644
--- a/src/liveedit.cc
+++ b/src/liveedit.cc
@@ -545,6 +545,11 @@ class FunctionInfoWrapper : public JSArrayBasedStruct<FunctionInfoWrapper> {
// wrapped into BlindReference for sanitizing reasons.
class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> {
public:
+ static bool IsInstance(Handle<JSArray> array) {
+ return array->length() == Smi::FromInt(kSize_) &&
+ array->GetElement(kSharedInfoOffset_)->IsJSValue();
+ }
+
explicit SharedInfoWrapper(Handle<JSArray> array)
: JSArrayBasedStruct<SharedInfoWrapper>(array) {
}
@@ -834,10 +839,14 @@ static bool IsJSFunctionCode(Code* code) {
}
-void LiveEdit::ReplaceFunctionCode(Handle<JSArray> new_compile_info_array,
- Handle<JSArray> shared_info_array) {
+Object* LiveEdit::ReplaceFunctionCode(Handle<JSArray> new_compile_info_array,
+ Handle<JSArray> shared_info_array) {
HandleScope scope;
+ if (!SharedInfoWrapper::IsInstance(shared_info_array)) {
+ return Top::ThrowIllegalOperation();
+ }
+
FunctionInfoWrapper compile_info_wrapper(new_compile_info_array);
SharedInfoWrapper shared_info_wrapper(shared_info_array);
@@ -860,7 +869,8 @@ void LiveEdit::ReplaceFunctionCode(Handle<JSArray> new_compile_info_array,
shared_info->set_construct_stub(
Builtins::builtin(Builtins::JSConstructStubGeneric));
- // update breakpoints
+
+ return Heap::undefined_value();
}
@@ -1024,8 +1034,13 @@ static Handle<Code> PatchPositionsInCode(Handle<Code> code,
}
-void LiveEdit::PatchFunctionPositions(
+Object* LiveEdit::PatchFunctionPositions(
Handle<JSArray> shared_info_array, Handle<JSArray> position_change_array) {
+
+ if (!SharedInfoWrapper::IsInstance(shared_info_array)) {
+ return Top::ThrowIllegalOperation();
+ }
+
SharedInfoWrapper shared_info_wrapper(shared_info_array);
Handle<SharedFunctionInfo> info = shared_info_wrapper.GetInfo();
@@ -1053,6 +1068,8 @@ void LiveEdit::PatchFunctionPositions(
ReplaceCodeObject(info->code(), *patched_code);
}
}
+
+ return Heap::undefined_value();
}
« no previous file with comments | « src/liveedit.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698