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

Side by Side Diff: src/builtins.cc

Issue 148503002: A64: Synchronize with r15545. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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/bootstrapper.cc ('k') | src/code-stubs.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "api.h" 30 #include "api.h"
31 #include "arguments.h" 31 #include "arguments.h"
32 #include "bootstrapper.h" 32 #include "bootstrapper.h"
33 #include "builtins.h" 33 #include "builtins.h"
34 #include "cpu-profiler.h"
34 #include "gdb-jit.h" 35 #include "gdb-jit.h"
35 #include "ic-inl.h" 36 #include "ic-inl.h"
36 #include "heap-profiler.h" 37 #include "heap-profiler.h"
37 #include "mark-compact.h" 38 #include "mark-compact.h"
38 #include "stub-cache.h" 39 #include "stub-cache.h"
39 #include "vm-state-inl.h" 40 #include "vm-state-inl.h"
40 41
41 namespace v8 { 42 namespace v8 {
42 namespace internal { 43 namespace internal {
43 44
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // has been specialized for each architecture so if any one of them 175 // has been specialized for each architecture so if any one of them
175 // changes this code has to be changed as well. 176 // changes this code has to be changed as well.
176 const int kMarkerOffset = StandardFrameConstants::kMarkerOffset; 177 const int kMarkerOffset = StandardFrameConstants::kMarkerOffset;
177 const Smi* kConstructMarker = Smi::FromInt(StackFrame::CONSTRUCT); 178 const Smi* kConstructMarker = Smi::FromInt(StackFrame::CONSTRUCT);
178 Object* marker = Memory::Object_at(caller_fp + kMarkerOffset); 179 Object* marker = Memory::Object_at(caller_fp + kMarkerOffset);
179 bool result = (marker == kConstructMarker); 180 bool result = (marker == kConstructMarker);
180 ASSERT_EQ(result, reference_result); 181 ASSERT_EQ(result, reference_result);
181 return result; 182 return result;
182 } 183 }
183 184
185
184 // ---------------------------------------------------------------------------- 186 // ----------------------------------------------------------------------------
185 187
186 BUILTIN(Illegal) { 188 BUILTIN(Illegal) {
187 UNREACHABLE(); 189 UNREACHABLE();
188 return isolate->heap()->undefined_value(); // Make compiler happy. 190 return isolate->heap()->undefined_value(); // Make compiler happy.
189 } 191 }
190 192
191 193
192 BUILTIN(EmptyFunction) { 194 BUILTIN(EmptyFunction) {
193 return isolate->heap()->undefined_value(); 195 return isolate->heap()->undefined_value();
194 } 196 }
195 197
196 198
197 static MaybeObject* ArrayCodeGenericCommon(Arguments* args, 199 static MaybeObject* ArrayCodeGenericCommon(Arguments* args,
198 Isolate* isolate, 200 Isolate* isolate,
199 JSFunction* constructor) { 201 JSFunction* constructor) {
200 ASSERT(args->length() >= 1); 202 ASSERT(args->length() >= 1);
201 Heap* heap = isolate->heap(); 203 Heap* heap = isolate->heap();
202 isolate->counters()->array_function_runtime()->Increment(); 204 isolate->counters()->array_function_runtime()->Increment();
203 205
204 JSArray* array; 206 JSArray* array;
205 if (CalledAsConstructor(isolate)) { 207 if (CalledAsConstructor(isolate)) {
206 array = JSArray::cast((*args)[0]); 208 array = JSArray::cast((*args)[0]);
207 // Initialize elements and length in case later allocations fail so that the 209 // Initialize elements and length in case later allocations fail so that the
208 // array object is initialized in a valid state. 210 // array object is initialized in a valid state.
209 MaybeObject* maybe_array = array->Initialize(0); 211 MaybeObject* maybe_array = array->Initialize(0);
210 if (maybe_array->IsFailure()) return maybe_array; 212 if (maybe_array->IsFailure()) return maybe_array;
211 213
212 AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(array); 214 AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(array);
213 ElementsKind to_kind = array->GetElementsKind(); 215 if (info != NULL && info->IsValid()) {
214 if (info != NULL && info->GetElementsKindPayload(&to_kind)) { 216 AllocationSite* site = info->GetAllocationSite();
217 ElementsKind to_kind = site->GetElementsKindPayload();
215 if (IsMoreGeneralElementsKindTransition(array->GetElementsKind(), 218 if (IsMoreGeneralElementsKindTransition(array->GetElementsKind(),
216 to_kind)) { 219 to_kind)) {
217 // We have advice that we should change the elements kind 220 // We have advice that we should change the elements kind
218 if (FLAG_trace_track_allocation_sites) { 221 if (FLAG_trace_track_allocation_sites) {
219 PrintF("AllocationSiteInfo: pre-transitioning array %p(%s->%s)\n", 222 PrintF("AllocationSiteInfo: pre-transitioning array %p(%s->%s)\n",
220 reinterpret_cast<void*>(array), 223 reinterpret_cast<void*>(array),
221 ElementsKindToString(array->GetElementsKind()), 224 ElementsKindToString(array->GetElementsKind()),
222 ElementsKindToString(to_kind)); 225 ElementsKindToString(to_kind));
223 } 226 }
224 227
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 // ----------------------------------------------------------------------------- 1148 // -----------------------------------------------------------------------------
1146 // Strict mode poison pills 1149 // Strict mode poison pills
1147 1150
1148 1151
1149 BUILTIN(StrictModePoisonPill) { 1152 BUILTIN(StrictModePoisonPill) {
1150 HandleScope scope(isolate); 1153 HandleScope scope(isolate);
1151 return isolate->Throw(*isolate->factory()->NewTypeError( 1154 return isolate->Throw(*isolate->factory()->NewTypeError(
1152 "strict_poison_pill", HandleVector<Object>(NULL, 0))); 1155 "strict_poison_pill", HandleVector<Object>(NULL, 0)));
1153 } 1156 }
1154 1157
1158
1155 // ----------------------------------------------------------------------------- 1159 // -----------------------------------------------------------------------------
1156 // 1160 //
1157 1161
1158 1162
1159 // Searches the hidden prototype chain of the given object for the first 1163 // Searches the hidden prototype chain of the given object for the first
1160 // object that is an instance of the given type. If no such object can 1164 // object that is an instance of the given type. If no such object can
1161 // be found then Heap::null_value() is returned. 1165 // be found then Heap::null_value() is returned.
1162 static inline Object* FindHidden(Heap* heap, 1166 static inline Object* FindHidden(Heap* heap,
1163 Object* object, 1167 Object* object,
1164 FunctionTemplateInfo* type) { 1168 FunctionTemplateInfo* type) {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 1428
1425 static void Generate_KeyedLoadIC_String(MacroAssembler* masm) { 1429 static void Generate_KeyedLoadIC_String(MacroAssembler* masm) {
1426 KeyedLoadIC::GenerateString(masm); 1430 KeyedLoadIC::GenerateString(masm);
1427 } 1431 }
1428 1432
1429 1433
1430 static void Generate_KeyedLoadIC_PreMonomorphic(MacroAssembler* masm) { 1434 static void Generate_KeyedLoadIC_PreMonomorphic(MacroAssembler* masm) {
1431 KeyedLoadIC::GeneratePreMonomorphic(masm); 1435 KeyedLoadIC::GeneratePreMonomorphic(masm);
1432 } 1436 }
1433 1437
1438
1434 static void Generate_KeyedLoadIC_IndexedInterceptor(MacroAssembler* masm) { 1439 static void Generate_KeyedLoadIC_IndexedInterceptor(MacroAssembler* masm) {
1435 KeyedLoadIC::GenerateIndexedInterceptor(masm); 1440 KeyedLoadIC::GenerateIndexedInterceptor(masm);
1436 } 1441 }
1437 1442
1443
1438 static void Generate_KeyedLoadIC_NonStrictArguments(MacroAssembler* masm) { 1444 static void Generate_KeyedLoadIC_NonStrictArguments(MacroAssembler* masm) {
1439 KeyedLoadIC::GenerateNonStrictArguments(masm); 1445 KeyedLoadIC::GenerateNonStrictArguments(masm);
1440 } 1446 }
1441 1447
1448
1442 static void Generate_StoreIC_Slow(MacroAssembler* masm) { 1449 static void Generate_StoreIC_Slow(MacroAssembler* masm) {
1443 StoreIC::GenerateSlow(masm); 1450 StoreIC::GenerateSlow(masm);
1444 } 1451 }
1445 1452
1446 1453
1447 static void Generate_StoreIC_Initialize(MacroAssembler* masm) { 1454 static void Generate_StoreIC_Initialize(MacroAssembler* masm) {
1448 StoreIC::GenerateInitialize(masm); 1455 StoreIC::GenerateInitialize(masm);
1449 } 1456 }
1450 1457
1451 1458
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1531 1538
1532 static void Generate_KeyedStoreIC_Initialize(MacroAssembler* masm) { 1539 static void Generate_KeyedStoreIC_Initialize(MacroAssembler* masm) {
1533 KeyedStoreIC::GenerateInitialize(masm); 1540 KeyedStoreIC::GenerateInitialize(masm);
1534 } 1541 }
1535 1542
1536 1543
1537 static void Generate_KeyedStoreIC_Initialize_Strict(MacroAssembler* masm) { 1544 static void Generate_KeyedStoreIC_Initialize_Strict(MacroAssembler* masm) {
1538 KeyedStoreIC::GenerateInitialize(masm); 1545 KeyedStoreIC::GenerateInitialize(masm);
1539 } 1546 }
1540 1547
1548
1541 static void Generate_KeyedStoreIC_NonStrictArguments(MacroAssembler* masm) { 1549 static void Generate_KeyedStoreIC_NonStrictArguments(MacroAssembler* masm) {
1542 KeyedStoreIC::GenerateNonStrictArguments(masm); 1550 KeyedStoreIC::GenerateNonStrictArguments(masm);
1543 } 1551 }
1544 1552
1553
1545 static void Generate_TransitionElementsSmiToDouble(MacroAssembler* masm) { 1554 static void Generate_TransitionElementsSmiToDouble(MacroAssembler* masm) {
1546 KeyedStoreIC::GenerateTransitionElementsSmiToDouble(masm); 1555 KeyedStoreIC::GenerateTransitionElementsSmiToDouble(masm);
1547 } 1556 }
1548 1557
1558
1549 static void Generate_TransitionElementsDoubleToObject(MacroAssembler* masm) { 1559 static void Generate_TransitionElementsDoubleToObject(MacroAssembler* masm) {
1550 KeyedStoreIC::GenerateTransitionElementsDoubleToObject(masm); 1560 KeyedStoreIC::GenerateTransitionElementsDoubleToObject(masm);
1551 } 1561 }
1552 1562
1553 #ifdef ENABLE_DEBUGGER_SUPPORT 1563 #ifdef ENABLE_DEBUGGER_SUPPORT
1554 static void Generate_LoadIC_DebugBreak(MacroAssembler* masm) { 1564 static void Generate_LoadIC_DebugBreak(MacroAssembler* masm) {
1555 Debug::GenerateLoadICDebugBreak(masm); 1565 Debug::GenerateLoadICDebugBreak(masm);
1556 } 1566 }
1557 1567
1558 1568
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 ++functions; 1718 ++functions;
1709 1719
1710 BUILTIN_LIST_C(DEF_FUNCTION_PTR_C) 1720 BUILTIN_LIST_C(DEF_FUNCTION_PTR_C)
1711 BUILTIN_LIST_A(DEF_FUNCTION_PTR_A) 1721 BUILTIN_LIST_A(DEF_FUNCTION_PTR_A)
1712 BUILTIN_LIST_DEBUG_A(DEF_FUNCTION_PTR_A) 1722 BUILTIN_LIST_DEBUG_A(DEF_FUNCTION_PTR_A)
1713 1723
1714 #undef DEF_FUNCTION_PTR_C 1724 #undef DEF_FUNCTION_PTR_C
1715 #undef DEF_FUNCTION_PTR_A 1725 #undef DEF_FUNCTION_PTR_A
1716 } 1726 }
1717 1727
1728
1718 void Builtins::SetUp(bool create_heap_objects) { 1729 void Builtins::SetUp(bool create_heap_objects) {
1719 ASSERT(!initialized_); 1730 ASSERT(!initialized_);
1720 Isolate* isolate = Isolate::Current(); 1731 Isolate* isolate = Isolate::Current();
1721 Heap* heap = isolate->heap(); 1732 Heap* heap = isolate->heap();
1722 1733
1723 // Create a scope for the handles in the builtins. 1734 // Create a scope for the handles in the builtins.
1724 HandleScope scope(isolate); 1735 HandleScope scope(isolate);
1725 1736
1726 const BuiltinDesc* functions = builtin_function_table.functions(); 1737 const BuiltinDesc* functions = builtin_function_table.functions();
1727 1738
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 return Handle<Code>(code_address); \ 1837 return Handle<Code>(code_address); \
1827 } 1838 }
1828 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1839 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1829 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1840 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1830 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1841 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1831 #undef DEFINE_BUILTIN_ACCESSOR_C 1842 #undef DEFINE_BUILTIN_ACCESSOR_C
1832 #undef DEFINE_BUILTIN_ACCESSOR_A 1843 #undef DEFINE_BUILTIN_ACCESSOR_A
1833 1844
1834 1845
1835 } } // namespace v8::internal 1846 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698