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

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

Issue 6677076: Merge up to bleeding_edge r7201 to isolates branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/isolates
Patch Set: Fix lint. Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | src/arm/lithium-arm.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 VisitForAccumulatorValue(function); 772 VisitForAccumulatorValue(function);
773 __ pop(r2); 773 __ pop(r2);
774 } else { 774 } else {
775 __ mov(r2, r0); 775 __ mov(r2, r0);
776 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex); 776 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex);
777 } 777 }
778 ASSERT(prop->key()->AsLiteral() != NULL && 778 ASSERT(prop->key()->AsLiteral() != NULL &&
779 prop->key()->AsLiteral()->handle()->IsSmi()); 779 prop->key()->AsLiteral()->handle()->IsSmi());
780 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); 780 __ mov(r1, Operand(prop->key()->AsLiteral()->handle()));
781 781
782 Handle<Code> ic(isolate()->builtins()->builtin(is_strict() 782 Handle<Code> ic(isolate()->builtins()->builtin(is_strict_mode()
783 ? Builtins::KeyedStoreIC_Initialize_Strict 783 ? Builtins::KeyedStoreIC_Initialize_Strict
784 : Builtins::KeyedStoreIC_Initialize)); 784 : Builtins::KeyedStoreIC_Initialize));
785 EmitCallIC(ic, RelocInfo::CODE_TARGET); 785 EmitCallIC(ic, RelocInfo::CODE_TARGET);
786 // Value in r0 is ignored (declarations are statements). 786 // Value in r0 is ignored (declarations are statements).
787 } 787 }
788 } 788 }
789 } 789 }
790 790
791 791
792 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { 792 void FullCodeGenerator::VisitDeclaration(Declaration* decl) {
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 EmitVariableAssignment(var, Token::ASSIGN); 1832 EmitVariableAssignment(var, Token::ASSIGN);
1833 break; 1833 break;
1834 } 1834 }
1835 case NAMED_PROPERTY: { 1835 case NAMED_PROPERTY: {
1836 __ push(r0); // Preserve value. 1836 __ push(r0); // Preserve value.
1837 VisitForAccumulatorValue(prop->obj()); 1837 VisitForAccumulatorValue(prop->obj());
1838 __ mov(r1, r0); 1838 __ mov(r1, r0);
1839 __ pop(r0); // Restore value. 1839 __ pop(r0); // Restore value.
1840 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); 1840 __ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
1841 Handle<Code> ic(isolate()->builtins()->builtin( 1841 Handle<Code> ic(isolate()->builtins()->builtin(
1842 is_strict() ? Builtins::StoreIC_Initialize_Strict 1842 is_strict_mode() ? Builtins::StoreIC_Initialize_Strict
1843 : Builtins::StoreIC_Initialize)); 1843 : Builtins::StoreIC_Initialize));
1844 EmitCallIC(ic, RelocInfo::CODE_TARGET); 1844 EmitCallIC(ic, RelocInfo::CODE_TARGET);
1845 break; 1845 break;
1846 } 1846 }
1847 case KEYED_PROPERTY: { 1847 case KEYED_PROPERTY: {
1848 __ push(r0); // Preserve value. 1848 __ push(r0); // Preserve value.
1849 if (prop->is_synthetic()) { 1849 if (prop->is_synthetic()) {
1850 ASSERT(prop->obj()->AsVariableProxy() != NULL); 1850 ASSERT(prop->obj()->AsVariableProxy() != NULL);
1851 ASSERT(prop->key()->AsLiteral() != NULL); 1851 ASSERT(prop->key()->AsLiteral() != NULL);
1852 { AccumulatorValueContext for_object(this); 1852 { AccumulatorValueContext for_object(this);
1853 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); 1853 EmitVariableLoad(prop->obj()->AsVariableProxy()->var());
1854 } 1854 }
1855 __ mov(r2, r0); 1855 __ mov(r2, r0);
1856 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); 1856 __ mov(r1, Operand(prop->key()->AsLiteral()->handle()));
1857 } else { 1857 } else {
1858 VisitForStackValue(prop->obj()); 1858 VisitForStackValue(prop->obj());
1859 VisitForAccumulatorValue(prop->key()); 1859 VisitForAccumulatorValue(prop->key());
1860 __ mov(r1, r0); 1860 __ mov(r1, r0);
1861 __ pop(r2); 1861 __ pop(r2);
1862 } 1862 }
1863 __ pop(r0); // Restore value. 1863 __ pop(r0); // Restore value.
1864 Handle<Code> ic(isolate()->builtins()->builtin( 1864 Handle<Code> ic(isolate()->builtins()->builtin(
1865 is_strict() ? Builtins::KeyedStoreIC_Initialize_Strict 1865 is_strict_mode() ? Builtins::KeyedStoreIC_Initialize_Strict
1866 : Builtins::KeyedStoreIC_Initialize)); 1866 : Builtins::KeyedStoreIC_Initialize));
1867 EmitCallIC(ic, RelocInfo::CODE_TARGET); 1867 EmitCallIC(ic, RelocInfo::CODE_TARGET);
1868 break; 1868 break;
1869 } 1869 }
1870 } 1870 }
1871 PrepareForBailoutForId(bailout_ast_id, TOS_REG); 1871 PrepareForBailoutForId(bailout_ast_id, TOS_REG);
1872 context()->Plug(r0); 1872 context()->Plug(r0);
1873 } 1873 }
1874 1874
1875 1875
1876 void FullCodeGenerator::EmitVariableAssignment(Variable* var, 1876 void FullCodeGenerator::EmitVariableAssignment(Variable* var,
1877 Token::Value op) { 1877 Token::Value op) {
1878 // Left-hand sides that rewrite to explicit property accesses do not reach 1878 // Left-hand sides that rewrite to explicit property accesses do not reach
1879 // here. 1879 // here.
1880 ASSERT(var != NULL); 1880 ASSERT(var != NULL);
1881 ASSERT(var->is_global() || var->AsSlot() != NULL); 1881 ASSERT(var->is_global() || var->AsSlot() != NULL);
1882 1882
1883 if (var->is_global()) { 1883 if (var->is_global()) {
1884 ASSERT(!var->is_this()); 1884 ASSERT(!var->is_this());
1885 // Assignment to a global variable. Use inline caching for the 1885 // Assignment to a global variable. Use inline caching for the
1886 // assignment. Right-hand-side value is passed in r0, variable name in 1886 // assignment. Right-hand-side value is passed in r0, variable name in
1887 // r2, and the global object in r1. 1887 // r2, and the global object in r1.
1888 __ mov(r2, Operand(var->name())); 1888 __ mov(r2, Operand(var->name()));
1889 __ ldr(r1, GlobalObjectOperand()); 1889 __ ldr(r1, GlobalObjectOperand());
1890 Handle<Code> ic(isolate()->builtins()->builtin( 1890 Handle<Code> ic(isolate()->builtins()->builtin(
1891 is_strict() ? Builtins::StoreIC_Initialize_Strict 1891 is_strict_mode() ? Builtins::StoreIC_Initialize_Strict
1892 : Builtins::StoreIC_Initialize)); 1892 : Builtins::StoreIC_Initialize));
1893 EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT); 1893 EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT);
1894 1894
1895 } else if (op == Token::INIT_CONST) { 1895 } else if (op == Token::INIT_CONST) {
1896 // Like var declarations, const declarations are hoisted to function 1896 // Like var declarations, const declarations are hoisted to function
1897 // scope. However, unlike var initializers, const initializers are able 1897 // scope. However, unlike var initializers, const initializers are able
1898 // to drill a hole to that function context, even from inside a 'with' 1898 // to drill a hole to that function context, even from inside a 'with'
1899 // context. We thus bypass the normal static scope lookup. 1899 // context. We thus bypass the normal static scope lookup.
1900 Slot* slot = var->AsSlot(); 1900 Slot* slot = var->AsSlot();
1901 Label skip; 1901 Label skip;
1902 switch (slot->type()) { 1902 switch (slot->type()) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); 1990 __ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
1991 // Load receiver to r1. Leave a copy in the stack if needed for turning the 1991 // Load receiver to r1. Leave a copy in the stack if needed for turning the
1992 // receiver into fast case. 1992 // receiver into fast case.
1993 if (expr->ends_initialization_block()) { 1993 if (expr->ends_initialization_block()) {
1994 __ ldr(r1, MemOperand(sp)); 1994 __ ldr(r1, MemOperand(sp));
1995 } else { 1995 } else {
1996 __ pop(r1); 1996 __ pop(r1);
1997 } 1997 }
1998 1998
1999 Handle<Code> ic(isolate()->builtins()->builtin( 1999 Handle<Code> ic(isolate()->builtins()->builtin(
2000 is_strict() ? Builtins::StoreIC_Initialize_Strict 2000 is_strict_mode() ? Builtins::StoreIC_Initialize_Strict
2001 : Builtins::StoreIC_Initialize)); 2001 : Builtins::StoreIC_Initialize));
2002 EmitCallIC(ic, RelocInfo::CODE_TARGET); 2002 EmitCallIC(ic, RelocInfo::CODE_TARGET);
2003 2003
2004 // If the assignment ends an initialization block, revert to fast case. 2004 // If the assignment ends an initialization block, revert to fast case.
2005 if (expr->ends_initialization_block()) { 2005 if (expr->ends_initialization_block()) {
2006 __ push(r0); // Result of assignment, saved even if not needed. 2006 __ push(r0); // Result of assignment, saved even if not needed.
2007 // Receiver is under the result value. 2007 // Receiver is under the result value.
2008 __ ldr(ip, MemOperand(sp, kPointerSize)); 2008 __ ldr(ip, MemOperand(sp, kPointerSize));
2009 __ push(ip); 2009 __ push(ip);
2010 __ CallRuntime(Runtime::kToFastProperties, 1); 2010 __ CallRuntime(Runtime::kToFastProperties, 1);
2011 __ pop(r0); 2011 __ pop(r0);
(...skipping 24 matching lines...) Expand all
2036 __ pop(r1); // Key. 2036 __ pop(r1); // Key.
2037 // Load receiver to r2. Leave a copy in the stack if needed for turning the 2037 // Load receiver to r2. Leave a copy in the stack if needed for turning the
2038 // receiver into fast case. 2038 // receiver into fast case.
2039 if (expr->ends_initialization_block()) { 2039 if (expr->ends_initialization_block()) {
2040 __ ldr(r2, MemOperand(sp)); 2040 __ ldr(r2, MemOperand(sp));
2041 } else { 2041 } else {
2042 __ pop(r2); 2042 __ pop(r2);
2043 } 2043 }
2044 2044
2045 Handle<Code> ic(isolate()->builtins()->builtin( 2045 Handle<Code> ic(isolate()->builtins()->builtin(
2046 is_strict() ? Builtins::KeyedStoreIC_Initialize_Strict 2046 is_strict_mode() ? Builtins::KeyedStoreIC_Initialize_Strict
2047 : Builtins::KeyedStoreIC_Initialize)); 2047 : Builtins::KeyedStoreIC_Initialize));
2048 EmitCallIC(ic, RelocInfo::CODE_TARGET); 2048 EmitCallIC(ic, RelocInfo::CODE_TARGET);
2049 2049
2050 // If the assignment ends an initialization block, revert to fast case. 2050 // If the assignment ends an initialization block, revert to fast case.
2051 if (expr->ends_initialization_block()) { 2051 if (expr->ends_initialization_block()) {
2052 __ push(r0); // Result of assignment, saved even if not needed. 2052 __ push(r0); // Result of assignment, saved even if not needed.
2053 // Receiver is under the result value. 2053 // Receiver is under the result value.
2054 __ ldr(ip, MemOperand(sp, kPointerSize)); 2054 __ ldr(ip, MemOperand(sp, kPointerSize));
2055 __ push(ip); 2055 __ push(ip);
2056 __ CallRuntime(Runtime::kToFastProperties, 1); 2056 __ CallRuntime(Runtime::kToFastProperties, 1);
2057 __ pop(r0); 2057 __ pop(r0);
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
3137 Register index1 = r1; 3137 Register index1 = r1;
3138 Register index2 = r2; 3138 Register index2 = r2;
3139 Register elements = r3; 3139 Register elements = r3;
3140 Register scratch1 = r4; 3140 Register scratch1 = r4;
3141 Register scratch2 = r5; 3141 Register scratch2 = r5;
3142 3142
3143 __ ldr(object, MemOperand(sp, 2 * kPointerSize)); 3143 __ ldr(object, MemOperand(sp, 2 * kPointerSize));
3144 // Fetch the map and check if array is in fast case. 3144 // Fetch the map and check if array is in fast case.
3145 // Check that object doesn't require security checks and 3145 // Check that object doesn't require security checks and
3146 // has no indexed interceptor. 3146 // has no indexed interceptor.
3147 __ CompareObjectType(object, scratch1, scratch2, FIRST_JS_OBJECT_TYPE); 3147 __ CompareObjectType(object, scratch1, scratch2, JS_ARRAY_TYPE);
3148 __ b(lt, &slow_case); 3148 __ b(ne, &slow_case);
3149 // Map is now in scratch1. 3149 // Map is now in scratch1.
3150 3150
3151 __ ldrb(scratch2, FieldMemOperand(scratch1, Map::kBitFieldOffset)); 3151 __ ldrb(scratch2, FieldMemOperand(scratch1, Map::kBitFieldOffset));
3152 __ tst(scratch2, Operand(KeyedLoadIC::kSlowCaseBitFieldMask)); 3152 __ tst(scratch2, Operand(KeyedLoadIC::kSlowCaseBitFieldMask));
3153 __ b(ne, &slow_case); 3153 __ b(ne, &slow_case);
3154 3154
3155 // Check the object's elements are in fast case and writable. 3155 // Check the object's elements are in fast case and writable.
3156 __ ldr(elements, FieldMemOperand(object, JSObject::kElementsOffset)); 3156 __ ldr(elements, FieldMemOperand(object, JSObject::kElementsOffset));
3157 __ ldr(scratch1, FieldMemOperand(elements, HeapObject::kMapOffset)); 3157 __ ldr(scratch1, FieldMemOperand(elements, HeapObject::kMapOffset));
3158 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); 3158 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex);
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
3893 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 3893 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
3894 Token::ASSIGN); 3894 Token::ASSIGN);
3895 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 3895 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
3896 context()->Plug(r0); 3896 context()->Plug(r0);
3897 } 3897 }
3898 break; 3898 break;
3899 case NAMED_PROPERTY: { 3899 case NAMED_PROPERTY: {
3900 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); 3900 __ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
3901 __ pop(r1); 3901 __ pop(r1);
3902 Handle<Code> ic(isolate()->builtins()->builtin( 3902 Handle<Code> ic(isolate()->builtins()->builtin(
3903 is_strict() ? Builtins::StoreIC_Initialize_Strict 3903 is_strict_mode() ? Builtins::StoreIC_Initialize_Strict
3904 : Builtins::StoreIC_Initialize)); 3904 : Builtins::StoreIC_Initialize));
3905 EmitCallIC(ic, RelocInfo::CODE_TARGET); 3905 EmitCallIC(ic, RelocInfo::CODE_TARGET);
3906 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 3906 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
3907 if (expr->is_postfix()) { 3907 if (expr->is_postfix()) {
3908 if (!context()->IsEffect()) { 3908 if (!context()->IsEffect()) {
3909 context()->PlugTOS(); 3909 context()->PlugTOS();
3910 } 3910 }
3911 } else { 3911 } else {
3912 context()->Plug(r0); 3912 context()->Plug(r0);
3913 } 3913 }
3914 break; 3914 break;
3915 } 3915 }
3916 case KEYED_PROPERTY: { 3916 case KEYED_PROPERTY: {
3917 __ pop(r1); // Key. 3917 __ pop(r1); // Key.
3918 __ pop(r2); // Receiver. 3918 __ pop(r2); // Receiver.
3919 Handle<Code> ic(isolate()->builtins()->builtin( 3919 Handle<Code> ic(isolate()->builtins()->builtin(
3920 is_strict() ? Builtins::KeyedStoreIC_Initialize_Strict 3920 is_strict_mode() ? Builtins::KeyedStoreIC_Initialize_Strict
3921 : Builtins::KeyedStoreIC_Initialize)); 3921 : Builtins::KeyedStoreIC_Initialize));
3922 EmitCallIC(ic, RelocInfo::CODE_TARGET); 3922 EmitCallIC(ic, RelocInfo::CODE_TARGET);
3923 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 3923 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
3924 if (expr->is_postfix()) { 3924 if (expr->is_postfix()) {
3925 if (!context()->IsEffect()) { 3925 if (!context()->IsEffect()) {
3926 context()->PlugTOS(); 3926 context()->PlugTOS();
3927 } 3927 }
3928 } else { 3928 } else {
3929 context()->Plug(r0); 3929 context()->Plug(r0);
3930 } 3930 }
3931 break; 3931 break;
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
4297 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 4297 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
4298 __ add(pc, r1, Operand(masm_->CodeObject())); 4298 __ add(pc, r1, Operand(masm_->CodeObject()));
4299 } 4299 }
4300 4300
4301 4301
4302 #undef __ 4302 #undef __
4303 4303
4304 } } // namespace v8::internal 4304 } } // namespace v8::internal
4305 4305
4306 #endif // V8_TARGET_ARCH_ARM 4306 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | src/arm/lithium-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698