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

Side by Side Diff: src/full-codegen/arm/full-codegen-arm.cc

Issue 1724753002: [fullcodegen] Implement control flow across do-expressions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable verification. Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/full-codegen/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); 987 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
988 } 988 }
989 989
990 990
991 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { 991 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
992 Comment cmnt(masm_, "[ ForInStatement"); 992 Comment cmnt(masm_, "[ ForInStatement");
993 SetStatementPosition(stmt, SKIP_BREAK); 993 SetStatementPosition(stmt, SKIP_BREAK);
994 994
995 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); 995 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot();
996 996
997 Label loop, exit;
998 ForIn loop_statement(this, stmt);
999 increment_loop_depth();
1000
1001 // Get the object to enumerate over. 997 // Get the object to enumerate over.
1002 SetExpressionAsStatementPosition(stmt->enumerable()); 998 SetExpressionAsStatementPosition(stmt->enumerable());
1003 VisitForAccumulatorValue(stmt->enumerable()); 999 VisitForAccumulatorValue(stmt->enumerable());
1004 OperandStackDepthIncrement(ForIn::kElementCount); 1000 OperandStackDepthIncrement(5);
1001
1002 Label loop, exit;
1003 Iteration loop_statement(this, stmt);
1004 increment_loop_depth();
1005 1005
1006 // If the object is null or undefined, skip over the loop, otherwise convert 1006 // If the object is null or undefined, skip over the loop, otherwise convert
1007 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4. 1007 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4.
1008 Label convert, done_convert; 1008 Label convert, done_convert;
1009 __ JumpIfSmi(r0, &convert); 1009 __ JumpIfSmi(r0, &convert);
1010 __ CompareObjectType(r0, r1, r1, FIRST_JS_RECEIVER_TYPE); 1010 __ CompareObjectType(r0, r1, r1, FIRST_JS_RECEIVER_TYPE);
1011 __ b(ge, &done_convert); 1011 __ b(ge, &done_convert);
1012 __ CompareRoot(r0, Heap::kNullValueRootIndex); 1012 __ CompareRoot(r0, Heap::kNullValueRootIndex);
1013 __ b(eq, &exit); 1013 __ b(eq, &exit);
1014 __ CompareRoot(r0, Heap::kUndefinedValueRootIndex); 1014 __ CompareRoot(r0, Heap::kUndefinedValueRootIndex);
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 SetExpressionPosition(expr); 1881 SetExpressionPosition(expr);
1882 1882
1883 // Evaluate yielded value first; the initial iterator definition depends on 1883 // Evaluate yielded value first; the initial iterator definition depends on
1884 // this. It stays on the stack while we update the iterator. 1884 // this. It stays on the stack while we update the iterator.
1885 VisitForStackValue(expr->expression()); 1885 VisitForStackValue(expr->expression());
1886 1886
1887 switch (expr->yield_kind()) { 1887 switch (expr->yield_kind()) {
1888 case Yield::kSuspend: 1888 case Yield::kSuspend:
1889 // Pop value from top-of-stack slot; box result into result register. 1889 // Pop value from top-of-stack slot; box result into result register.
1890 EmitCreateIteratorResult(false); 1890 EmitCreateIteratorResult(false);
1891 __ push(result_register()); 1891 PushOperand(result_register());
1892 // Fall through. 1892 // Fall through.
1893 case Yield::kInitial: { 1893 case Yield::kInitial: {
1894 Label suspend, continuation, post_runtime, resume; 1894 Label suspend, continuation, post_runtime, resume;
1895 1895
1896 __ jmp(&suspend); 1896 __ jmp(&suspend);
1897 __ bind(&continuation); 1897 __ bind(&continuation);
1898 // When we arrive here, the stack top is the resume mode and 1898 // When we arrive here, the stack top is the resume mode and
1899 // result_register() holds the input value (the argument given to the 1899 // result_register() holds the input value (the argument given to the
1900 // respective resume operation). 1900 // respective resume operation).
1901 __ RecordGeneratorContinuation(); 1901 __ RecordGeneratorContinuation();
1902 __ pop(r1); 1902 __ pop(r1);
1903 __ cmp(r1, Operand(Smi::FromInt(JSGeneratorObject::RETURN))); 1903 __ cmp(r1, Operand(Smi::FromInt(JSGeneratorObject::RETURN)));
1904 __ b(ne, &resume); 1904 __ b(ne, &resume);
1905 __ push(result_register()); 1905 __ push(result_register());
1906 EmitCreateIteratorResult(true); 1906 EmitCreateIteratorResult(true);
1907 EmitUnwindAndReturn(); 1907 EmitUnwindAndReturn();
1908 1908
1909 __ bind(&suspend); 1909 __ bind(&suspend);
1910 OperandStackDepthIncrement(1); // Not popped on this path.
1910 VisitForAccumulatorValue(expr->generator_object()); 1911 VisitForAccumulatorValue(expr->generator_object());
1911 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); 1912 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos()));
1912 __ mov(r1, Operand(Smi::FromInt(continuation.pos()))); 1913 __ mov(r1, Operand(Smi::FromInt(continuation.pos())));
1913 __ str(r1, FieldMemOperand(r0, JSGeneratorObject::kContinuationOffset)); 1914 __ str(r1, FieldMemOperand(r0, JSGeneratorObject::kContinuationOffset));
1914 __ str(cp, FieldMemOperand(r0, JSGeneratorObject::kContextOffset)); 1915 __ str(cp, FieldMemOperand(r0, JSGeneratorObject::kContextOffset));
1915 __ mov(r1, cp); 1916 __ mov(r1, cp);
1916 __ RecordWriteField(r0, JSGeneratorObject::kContextOffset, r1, r2, 1917 __ RecordWriteField(r0, JSGeneratorObject::kContextOffset, r1, r2,
1917 kLRHasBeenSaved, kDontSaveFPRegs); 1918 kLRHasBeenSaved, kDontSaveFPRegs);
1918 __ add(r1, fp, Operand(StandardFrameConstants::kExpressionsOffset)); 1919 __ add(r1, fp, Operand(StandardFrameConstants::kExpressionsOffset));
1919 __ cmp(sp, r1); 1920 __ cmp(sp, r1);
1920 __ b(eq, &post_runtime); 1921 __ b(eq, &post_runtime);
1921 __ push(r0); // generator object 1922 __ push(r0); // generator object
1922 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); 1923 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
1923 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1924 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1924 __ bind(&post_runtime); 1925 __ bind(&post_runtime);
1925 PopOperand(result_register()); 1926 PopOperand(result_register());
1926 EmitReturnSequence(); 1927 EmitReturnSequence();
1927 1928
1928 __ bind(&resume); 1929 __ bind(&resume);
1929 context()->Plug(result_register()); 1930 context()->Plug(result_register());
1930 break; 1931 break;
1931 } 1932 }
1932 1933
1933 case Yield::kFinal: { 1934 case Yield::kFinal: {
1934 // Pop value from top-of-stack slot, box result into result register. 1935 // Pop value from top-of-stack slot, box result into result register.
1935 OperandStackDepthDecrement(1);
1936 EmitCreateIteratorResult(true); 1936 EmitCreateIteratorResult(true);
1937 EmitUnwindAndReturn(); 1937 EmitUnwindAndReturn();
1938 break; 1938 break;
1939 } 1939 }
1940 1940
1941 case Yield::kDelegating: 1941 case Yield::kDelegating:
1942 UNREACHABLE(); 1942 UNREACHABLE();
1943 } 1943 }
1944 } 1944 }
1945 1945
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 2074
2075 __ Allocate(JSIteratorResult::kSize, r0, r2, r3, &allocate, TAG_OBJECT); 2075 __ Allocate(JSIteratorResult::kSize, r0, r2, r3, &allocate, TAG_OBJECT);
2076 __ b(&done_allocate); 2076 __ b(&done_allocate);
2077 2077
2078 __ bind(&allocate); 2078 __ bind(&allocate);
2079 __ Push(Smi::FromInt(JSIteratorResult::kSize)); 2079 __ Push(Smi::FromInt(JSIteratorResult::kSize));
2080 __ CallRuntime(Runtime::kAllocateInNewSpace); 2080 __ CallRuntime(Runtime::kAllocateInNewSpace);
2081 2081
2082 __ bind(&done_allocate); 2082 __ bind(&done_allocate);
2083 __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, r1); 2083 __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, r1);
2084 __ pop(r2); 2084 PopOperand(r2);
2085 __ LoadRoot(r3, 2085 __ LoadRoot(r3,
2086 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); 2086 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex);
2087 __ LoadRoot(r4, Heap::kEmptyFixedArrayRootIndex); 2087 __ LoadRoot(r4, Heap::kEmptyFixedArrayRootIndex);
2088 __ str(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); 2088 __ str(r1, FieldMemOperand(r0, HeapObject::kMapOffset));
2089 __ str(r4, FieldMemOperand(r0, JSObject::kPropertiesOffset)); 2089 __ str(r4, FieldMemOperand(r0, JSObject::kPropertiesOffset));
2090 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); 2090 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset));
2091 __ str(r2, FieldMemOperand(r0, JSIteratorResult::kValueOffset)); 2091 __ str(r2, FieldMemOperand(r0, JSIteratorResult::kValueOffset));
2092 __ str(r3, FieldMemOperand(r0, JSIteratorResult::kDoneOffset)); 2092 __ str(r3, FieldMemOperand(r0, JSIteratorResult::kDoneOffset));
2093 } 2093 }
2094 2094
(...skipping 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 DCHECK(interrupt_address == 4307 DCHECK(interrupt_address ==
4308 isolate->builtins()->OsrAfterStackCheck()->entry()); 4308 isolate->builtins()->OsrAfterStackCheck()->entry());
4309 return OSR_AFTER_STACK_CHECK; 4309 return OSR_AFTER_STACK_CHECK;
4310 } 4310 }
4311 4311
4312 4312
4313 } // namespace internal 4313 } // namespace internal
4314 } // namespace v8 4314 } // namespace v8
4315 4315
4316 #endif // V8_TARGET_ARCH_ARM 4316 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698