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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 11818021: Allocation Info Tracking, continued. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 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 | Annotate | Revision Log
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 30 matching lines...) Expand all
41 41
42 namespace v8 { 42 namespace v8 {
43 namespace internal { 43 namespace internal {
44 44
45 45
46 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( 46 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor(
47 Isolate* isolate, 47 Isolate* isolate,
48 CodeStubInterfaceDescriptor* descriptor) { 48 CodeStubInterfaceDescriptor* descriptor) {
49 static Register registers[] = { edx, ecx }; 49 static Register registers[] = { edx, ecx };
50 descriptor->register_param_count_ = 2; 50 descriptor->register_param_count_ = 2;
51 descriptor->register_params_ = registers;
51 descriptor->stack_parameter_count_ = NULL; 52 descriptor->stack_parameter_count_ = NULL;
52 descriptor->register_params_ = registers;
53 descriptor->deoptimization_handler_ = 53 descriptor->deoptimization_handler_ =
54 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); 54 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
55 } 55 }
56 56
57 57
58 void TransitionElementsKindStub::InitializeInterfaceDescriptor( 58 void TransitionElementsKindStub::InitializeInterfaceDescriptor(
59 Isolate* isolate, 59 Isolate* isolate,
60 CodeStubInterfaceDescriptor* descriptor) { 60 CodeStubInterfaceDescriptor* descriptor) {
61 static Register registers[] = { eax, ebx }; 61 static Register registers[] = { eax, ebx };
62 descriptor->register_param_count_ = 2; 62 descriptor->register_param_count_ = 2;
63 descriptor->register_params_ = registers; 63 descriptor->register_params_ = registers;
64 descriptor->deoptimization_handler_ = 64 descriptor->deoptimization_handler_ =
65 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; 65 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry;
66 } 66 }
67 67
68 68
69 static void InitializeArrayConstructorDescriptor(Isolate* isolate, 69 static void InitializeArrayConstructorDescriptor(Isolate* isolate,
70 CodeStubInterfaceDescriptor* descriptor) { 70 CodeStubInterfaceDescriptor* descriptor) {
71 // register state
72 // edi -- constructor function
73 // ebx -- type info cell with elements kind
74 // eax -- number of arguments to the constructor function
71 static Register registers[] = { edi, ebx }; 75 static Register registers[] = { edi, ebx };
72 descriptor->register_param_count_ = 2; 76 descriptor->register_param_count_ = 2;
73 // stack param count needs (constructor pointer, and single argument) 77 // stack param count needs (constructor pointer, and single argument)
74 descriptor->stack_parameter_count_ = &eax; 78 descriptor->stack_parameter_count_ = &eax;
75 descriptor->register_params_ = registers; 79 descriptor->register_params_ = registers;
76 descriptor->extra_expression_stack_count_ = 1; 80 descriptor->extra_expression_stack_count_ = 1;
77 descriptor->deoptimization_handler_ = 81 descriptor->deoptimization_handler_ =
78 FUNCTION_ADDR(ArrayConstructor_StubFailure); 82 FUNCTION_ADDR(ArrayConstructor_StubFailure);
79 } 83 }
80 84
(...skipping 4763 matching lines...) Expand 10 before | Expand all | Expand 10 after
4844 // edi : the function to call 4848 // edi : the function to call
4845 Isolate* isolate = masm->isolate(); 4849 Isolate* isolate = masm->isolate();
4846 Label initialize, done, miss, megamorphic, not_array_function; 4850 Label initialize, done, miss, megamorphic, not_array_function;
4847 4851
4848 // Load the cache state into ecx. 4852 // Load the cache state into ecx.
4849 __ mov(ecx, FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset)); 4853 __ mov(ecx, FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset));
4850 4854
4851 // A monomorphic cache hit or an already megamorphic state: invoke the 4855 // A monomorphic cache hit or an already megamorphic state: invoke the
4852 // function without changing the state. 4856 // function without changing the state.
4853 __ cmp(ecx, edi); 4857 __ cmp(ecx, edi);
4854 __ j(equal, &done, Label::kFar); 4858 __ j(equal, &done);
4855 __ cmp(ecx, Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); 4859 __ cmp(ecx, Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate)));
4856 __ j(equal, &done, Label::kFar); 4860 __ j(equal, &done);
4857 4861
4858 // Special handling of the Array() function, which caches not only the 4862 // Special handling of the Array() function, which caches not only the
4859 // monomorphic Array function but the initial ElementsKind with special 4863 // monomorphic Array function but the initial ElementsKind with special
4860 // sentinels 4864 // sentinels
4861 Handle<Object> terminal_kind_sentinel = 4865 Handle<Object> terminal_kind_sentinel =
4862 TypeFeedbackCells::MonomorphicArraySentinel(LAST_FAST_ELEMENTS_KIND); 4866 TypeFeedbackCells::MonomorphicArraySentinel(LAST_FAST_ELEMENTS_KIND);
4863 __ cmp(ecx, Immediate(terminal_kind_sentinel)); 4867 __ cmp(ecx, Immediate(terminal_kind_sentinel));
4864 __ j(above, &miss, Label::kFar); 4868 __ j(above, &miss);
4865 // Load the global or builtins object from the current context 4869 // Load the global or builtins object from the current context
4866 __ mov(ecx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 4870 __ LoadGlobalContext(ecx);
4867 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalContextOffset));
4868 // Make sure the function is the Array() function 4871 // Make sure the function is the Array() function
4869 __ cmp(edi, Operand(ecx, 4872 __ cmp(edi, Operand(ecx,
4870 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); 4873 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX)));
4871 Label megamorphic_pre; 4874 __ j(not_equal, &megamorphic);
4872 __ j(not_equal, &megamorphic_pre, Label::kFar);
4873 __ jmp(&done); 4875 __ jmp(&done);
4874 4876
4875 __ bind(&megamorphic_pre);
4876 __ jmp(&megamorphic, Label::kFar);
4877
4878 __ bind(&miss); 4877 __ bind(&miss);
4879 4878
4880 // A monomorphic miss (i.e, here the cache is not uninitialized) goes 4879 // A monomorphic miss (i.e, here the cache is not uninitialized) goes
4881 // megamorphic. 4880 // megamorphic.
4882 __ cmp(ecx, Immediate(TypeFeedbackCells::UninitializedSentinel(isolate))); 4881 __ cmp(ecx, Immediate(TypeFeedbackCells::UninitializedSentinel(isolate)));
4883 __ j(equal, &initialize, Label::kFar); 4882 __ j(equal, &initialize);
4884 // MegamorphicSentinel is an immortal immovable object (undefined) so no 4883 // MegamorphicSentinel is an immortal immovable object (undefined) so no
4885 // write-barrier is needed. 4884 // write-barrier is needed.
4886 __ bind(&megamorphic); 4885 __ bind(&megamorphic);
4887 __ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset), 4886 __ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset),
4888 Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); 4887 Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate)));
4889 __ jmp(&done, Label::kNear); 4888 __ jmp(&done, Label::kNear);
4890 4889
4891 // An uninitialized cache is patched with the function or sentinel to 4890 // An uninitialized cache is patched with the function or sentinel to
4892 // indicate the ElementsKind if function is the Array constructor. 4891 // indicate the ElementsKind if function is the Array constructor.
4893 __ bind(&initialize); 4892 __ bind(&initialize);
4894 __ mov(ecx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 4893 __ LoadGlobalContext(ecx);
4895 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalContextOffset));
4896 // Make sure the function is the Array() function 4894 // Make sure the function is the Array() function
4897 __ cmp(edi, Operand(ecx, 4895 __ cmp(edi, Operand(ecx,
4898 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); 4896 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX)));
4899 __ j(not_equal, &not_array_function); 4897 __ j(not_equal, &not_array_function);
4900 4898
4901 // The target function is the Array constructor, install a sentinel value in 4899 // The target function is the Array constructor, install a sentinel value in
4902 // the constructor's type info cell that will track the initial ElementsKind 4900 // the constructor's type info cell that will track the initial ElementsKind
4903 // that should be used for the array when its constructed. 4901 // that should be used for the array when its constructed.
4904 Handle<Object> initial_kind_sentinel = 4902 Handle<Object> initial_kind_sentinel =
4905 TypeFeedbackCells::MonomorphicArraySentinel( 4903 TypeFeedbackCells::MonomorphicArraySentinel(
(...skipping 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after
7771 // Restore ecx. 7769 // Restore ecx.
7772 __ pop(ecx); 7770 __ pop(ecx);
7773 __ ret(0); 7771 __ ret(0);
7774 } 7772 }
7775 7773
7776 #undef __ 7774 #undef __
7777 7775
7778 } } // namespace v8::internal 7776 } } // namespace v8::internal
7779 7777
7780 #endif // V8_TARGET_ARCH_IA32 7778 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698