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

Unified Diff: src/builtins.cc

Issue 12221033: Use asserts instead of branches to avoid fast array methods for observed arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 16e672c16f6f7e2f25131de106e28d609b484aca..188528b6e0cb0e1eda448271c5a0213f9e1f0354 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698