Use asserts instead of branches to avoid fast array methods for observed arrays
Because observed arrays should always be in dictionary mode, we'll always fall back to the JS version anyway. Review URL: https://codereview.chromium.org/12221033 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13612 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
2dc84e9aec
commit
19232a1e7a
@ -525,12 +525,9 @@ BUILTIN(ArrayPush) {
|
||||
}
|
||||
if (!maybe_elms_obj->To(&elms_obj)) return maybe_elms_obj;
|
||||
|
||||
if (FLAG_harmony_observation &&
|
||||
JSObject::cast(receiver)->map()->is_observed()) {
|
||||
return CallJsBuiltin(isolate, "ArrayPush", args);
|
||||
}
|
||||
|
||||
JSArray* array = JSArray::cast(receiver);
|
||||
ASSERT(!array->map()->is_observed());
|
||||
|
||||
ElementsKind kind = array->GetElementsKind();
|
||||
|
||||
if (IsFastSmiOrObjectElementsKind(kind)) {
|
||||
@ -642,10 +639,7 @@ BUILTIN(ArrayPop) {
|
||||
if (!maybe_elms->To(&elms_obj)) return maybe_elms;
|
||||
|
||||
JSArray* array = JSArray::cast(receiver);
|
||||
|
||||
if (FLAG_harmony_observation && array->map()->is_observed()) {
|
||||
return CallJsBuiltin(isolate, "ArrayPop", args);
|
||||
}
|
||||
ASSERT(!array->map()->is_observed());
|
||||
|
||||
int len = Smi::cast(array->length())->value();
|
||||
if (len == 0) return heap->undefined_value();
|
||||
@ -680,10 +674,7 @@ BUILTIN(ArrayShift) {
|
||||
return CallJsBuiltin(isolate, "ArrayShift", args);
|
||||
}
|
||||
JSArray* array = JSArray::cast(receiver);
|
||||
|
||||
if (FLAG_harmony_observation && array->map()->is_observed()) {
|
||||
return CallJsBuiltin(isolate, "ArrayShift", args);
|
||||
}
|
||||
ASSERT(!array->map()->is_observed());
|
||||
|
||||
int len = Smi::cast(array->length())->value();
|
||||
if (len == 0) return heap->undefined_value();
|
||||
@ -734,15 +725,12 @@ BUILTIN(ArrayUnshift) {
|
||||
return CallJsBuiltin(isolate, "ArrayUnshift", args);
|
||||
}
|
||||
JSArray* array = JSArray::cast(receiver);
|
||||
ASSERT(!array->map()->is_observed());
|
||||
if (!array->HasFastSmiOrObjectElements()) {
|
||||
return CallJsBuiltin(isolate, "ArrayUnshift", args);
|
||||
}
|
||||
FixedArray* elms = FixedArray::cast(elms_obj);
|
||||
|
||||
if (FLAG_harmony_observation && array->map()->is_observed()) {
|
||||
return CallJsBuiltin(isolate, "ArrayUnshift", args);
|
||||
}
|
||||
|
||||
int len = Smi::cast(array->length())->value();
|
||||
int to_add = args.length() - 1;
|
||||
int new_length = len + to_add;
|
||||
@ -938,10 +926,7 @@ BUILTIN(ArraySplice) {
|
||||
return CallJsBuiltin(isolate, "ArraySplice", args);
|
||||
}
|
||||
JSArray* array = JSArray::cast(receiver);
|
||||
|
||||
if (FLAG_harmony_observation && array->map()->is_observed()) {
|
||||
return CallJsBuiltin(isolate, "ArraySplice", args);
|
||||
}
|
||||
ASSERT(!array->map()->is_observed());
|
||||
|
||||
int len = Smi::cast(array->length())->value();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user