Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index df70cd4fc799eb268dae74a9164a12631e360d72..620e4b36ce59fbef40713254c852c5220d68f086 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -510,6 +510,10 @@ BUILTIN(ArrayPush) { |
FixedArray* elms = FixedArray::cast(elms_obj); |
JSArray* array = JSArray::cast(receiver); |
+ if (FLAG_harmony_observation && array->map()->is_observed()) { |
+ return CallJsBuiltin(isolate, "ArrayPush", args); |
+ } |
+ |
int len = Smi::cast(array->length())->value(); |
int to_add = args.length() - 1; |
if (to_add == 0) { |
@@ -566,11 +570,15 @@ BUILTIN(ArrayPop) { |
FixedArray* elms = FixedArray::cast(elms_obj); |
JSArray* array = JSArray::cast(receiver); |
+ if (FLAG_harmony_observation && array->map()->is_observed()) { |
+ return CallJsBuiltin(isolate, "ArrayPop", args); |
+ } |
+ |
int len = Smi::cast(array->length())->value(); |
if (len == 0) return heap->undefined_value(); |
// Get top element |
- MaybeObject* top = elms->get(len - 1); |
+ Object* top = elms->get(len - 1); |
// Set the length. |
array->set_length(Smi::FromInt(len - 1)); |
@@ -581,9 +589,7 @@ BUILTIN(ArrayPop) { |
return top; |
} |
- top = array->GetPrototype()->GetElement(len - 1); |
- |
- return top; |
+ return array->GetPrototype()->GetElement(len - 1); |
} |
@@ -604,6 +610,10 @@ BUILTIN(ArrayShift) { |
JSArray* array = JSArray::cast(receiver); |
ASSERT(array->HasFastSmiOrObjectElements()); |
+ if (FLAG_harmony_observation && array->map()->is_observed()) { |
+ return CallJsBuiltin(isolate, "ArrayShift", args); |
+ } |
+ |
int len = Smi::cast(array->length())->value(); |
if (len == 0) return heap->undefined_value(); |
@@ -646,6 +656,10 @@ BUILTIN(ArrayUnshift) { |
JSArray* array = JSArray::cast(receiver); |
ASSERT(array->HasFastSmiOrObjectElements()); |
+ 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; |
@@ -802,6 +816,10 @@ BUILTIN(ArraySplice) { |
JSArray* array = JSArray::cast(receiver); |
ASSERT(array->HasFastSmiOrObjectElements()); |
+ if (FLAG_harmony_observation && array->map()->is_observed()) { |
+ return CallJsBuiltin(isolate, "ArraySplice", args); |
+ } |
+ |
int len = Smi::cast(array->length())->value(); |
int n_arguments = args.length() - 1; |