for-of should throw if result object is not an object

This is done using desugaring. Before this we had:

  result = iterator.next()

with this we instead do:

  !%_IsSpecObject(result = iterator.next()) &&
      %ThrowIteratorResultNotAnObject(result)

BUG=v8:3916
LOG=N

Review URL: https://codereview.chromium.org/929733003

Cr-Commit-Position: refs/heads/master@{#26806}
This commit is contained in:
arv 2015-02-23 15:34:34 -08:00 committed by Commit bot
parent 87f77d6aba
commit ab2591ed93

View File

@ -65,6 +65,16 @@ RUNTIME_FUNCTION(Runtime_ThrowIteratorResultNotAnObject) {
}
RUNTIME_FUNCTION(Runtime_ThrowIteratorResultNotAnObject) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
THROW_NEW_ERROR_RETURN_FAILURE(
isolate,
NewTypeError("iterator_result_not_an_object", HandleVector(&value, 1)));
}
RUNTIME_FUNCTION(Runtime_PromiseRejectEvent) {
DCHECK(args.length() == 3);
HandleScope scope(isolate);