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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 19485008: Replace CONSTANT_FUNCTION by CONSTANT (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 5 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/ia32/lithium-codegen-ia32.h ('k') | src/ia32/stub-cache-ia32.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 // 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 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 } 1835 }
1836 } 1836 }
1837 } 1837 }
1838 } 1838 }
1839 1839
1840 1840
1841 void LCodeGen::DoConstantT(LConstantT* instr) { 1841 void LCodeGen::DoConstantT(LConstantT* instr) {
1842 Register reg = ToRegister(instr->result()); 1842 Register reg = ToRegister(instr->result());
1843 Handle<Object> handle = instr->value(); 1843 Handle<Object> handle = instr->value();
1844 AllowDeferredHandleDereference smi_check; 1844 AllowDeferredHandleDereference smi_check;
1845 if (handle->IsHeapObject()) { 1845 __ LoadObject(reg, handle);
1846 __ LoadHeapObject(reg, Handle<HeapObject>::cast(handle));
1847 } else {
1848 __ Set(reg, Immediate(handle));
1849 }
1850 } 1846 }
1851 1847
1852 1848
1853 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { 1849 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
1854 Register result = ToRegister(instr->result()); 1850 Register result = ToRegister(instr->result());
1855 Register map = ToRegister(instr->value()); 1851 Register map = ToRegister(instr->value());
1856 __ EnumLength(result, map); 1852 __ EnumLength(result, map);
1857 } 1853 }
1858 1854
1859 1855
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
3067 Register result = ToRegister(instr->result()); 3063 Register result = ToRegister(instr->result());
3068 if (access.IsInobject()) { 3064 if (access.IsInobject()) {
3069 __ mov(result, FieldOperand(object, offset)); 3065 __ mov(result, FieldOperand(object, offset));
3070 } else { 3066 } else {
3071 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); 3067 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset));
3072 __ mov(result, FieldOperand(result, offset)); 3068 __ mov(result, FieldOperand(result, offset));
3073 } 3069 }
3074 } 3070 }
3075 3071
3076 3072
3077 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, 3073 void LCodeGen::EmitLoadFieldOrConstant(Register result,
3078 Register object, 3074 Register object,
3079 Handle<Map> type, 3075 Handle<Map> type,
3080 Handle<String> name, 3076 Handle<String> name,
3081 LEnvironment* env) { 3077 LEnvironment* env) {
3082 LookupResult lookup(isolate()); 3078 LookupResult lookup(isolate());
3083 type->LookupDescriptor(NULL, *name, &lookup); 3079 type->LookupDescriptor(NULL, *name, &lookup);
3084 ASSERT(lookup.IsFound() || lookup.IsCacheable()); 3080 ASSERT(lookup.IsFound() || lookup.IsCacheable());
3085 if (lookup.IsField()) { 3081 if (lookup.IsField()) {
3086 int index = lookup.GetLocalFieldIndexFromMap(*type); 3082 int index = lookup.GetLocalFieldIndexFromMap(*type);
3087 int offset = index * kPointerSize; 3083 int offset = index * kPointerSize;
3088 if (index < 0) { 3084 if (index < 0) {
3089 // Negative property indices are in-object properties, indexed 3085 // Negative property indices are in-object properties, indexed
3090 // from the end of the fixed part of the object. 3086 // from the end of the fixed part of the object.
3091 __ mov(result, FieldOperand(object, offset + type->instance_size())); 3087 __ mov(result, FieldOperand(object, offset + type->instance_size()));
3092 } else { 3088 } else {
3093 // Non-negative property indices are in the properties array. 3089 // Non-negative property indices are in the properties array.
3094 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); 3090 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset));
3095 __ mov(result, FieldOperand(result, offset + FixedArray::kHeaderSize)); 3091 __ mov(result, FieldOperand(result, offset + FixedArray::kHeaderSize));
3096 } 3092 }
3097 } else if (lookup.IsConstantFunction()) { 3093 } else if (lookup.IsConstant()) {
3098 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type)); 3094 Handle<Object> constant(lookup.GetConstantFromMap(*type), isolate());
3099 __ LoadHeapObject(result, function); 3095 __ LoadObject(result, constant);
3100 } else { 3096 } else {
3101 // Negative lookup. 3097 // Negative lookup.
3102 // Check prototypes. 3098 // Check prototypes.
3103 Handle<HeapObject> current(HeapObject::cast((*type)->prototype())); 3099 Handle<HeapObject> current(HeapObject::cast((*type)->prototype()));
3104 Heap* heap = type->GetHeap(); 3100 Heap* heap = type->GetHeap();
3105 while (*current != heap->null_value()) { 3101 while (*current != heap->null_value()) {
3106 __ LoadHeapObject(result, current); 3102 __ LoadHeapObject(result, current);
3107 __ cmp(FieldOperand(result, HeapObject::kMapOffset), 3103 __ cmp(FieldOperand(result, HeapObject::kMapOffset),
3108 Handle<Map>(current->map())); 3104 Handle<Map>(current->map()));
3109 DeoptimizeIf(not_equal, env); 3105 DeoptimizeIf(not_equal, env);
(...skipping 28 matching lines...) Expand all
3138 static bool CompactEmit(SmallMapList* list, 3134 static bool CompactEmit(SmallMapList* list,
3139 Handle<String> name, 3135 Handle<String> name,
3140 int i, 3136 int i,
3141 Isolate* isolate) { 3137 Isolate* isolate) {
3142 Handle<Map> map = list->at(i); 3138 Handle<Map> map = list->at(i);
3143 // If the map has ElementsKind transitions, we will generate map checks 3139 // If the map has ElementsKind transitions, we will generate map checks
3144 // for each kind in __ CompareMap(..., ALLOW_ELEMENTS_TRANSITION_MAPS). 3140 // for each kind in __ CompareMap(..., ALLOW_ELEMENTS_TRANSITION_MAPS).
3145 if (map->HasElementsTransition()) return false; 3141 if (map->HasElementsTransition()) return false;
3146 LookupResult lookup(isolate); 3142 LookupResult lookup(isolate);
3147 map->LookupDescriptor(NULL, *name, &lookup); 3143 map->LookupDescriptor(NULL, *name, &lookup);
3148 return lookup.IsField() || lookup.IsConstantFunction(); 3144 return lookup.IsField() || lookup.IsConstant();
3149 } 3145 }
3150 3146
3151 3147
3152 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { 3148 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
3153 Register object = ToRegister(instr->object()); 3149 Register object = ToRegister(instr->object());
3154 Register result = ToRegister(instr->result()); 3150 Register result = ToRegister(instr->result());
3155 3151
3156 int map_count = instr->hydrogen()->types()->length(); 3152 int map_count = instr->hydrogen()->types()->length();
3157 bool need_generic = instr->hydrogen()->need_generic(); 3153 bool need_generic = instr->hydrogen()->need_generic();
3158 3154
(...skipping 11 matching lines...) Expand all
3170 } 3166 }
3171 } 3167 }
3172 for (int i = 0; i < map_count; ++i) { 3168 for (int i = 0; i < map_count; ++i) {
3173 bool last = (i == map_count - 1); 3169 bool last = (i == map_count - 1);
3174 Handle<Map> map = instr->hydrogen()->types()->at(i); 3170 Handle<Map> map = instr->hydrogen()->types()->at(i);
3175 Label check_passed; 3171 Label check_passed;
3176 __ CompareMap(object, map, &check_passed); 3172 __ CompareMap(object, map, &check_passed);
3177 if (last && !need_generic) { 3173 if (last && !need_generic) {
3178 DeoptimizeIf(not_equal, instr->environment()); 3174 DeoptimizeIf(not_equal, instr->environment());
3179 __ bind(&check_passed); 3175 __ bind(&check_passed);
3180 EmitLoadFieldOrConstantFunction( 3176 EmitLoadFieldOrConstant(result, object, map, name, instr->environment());
3181 result, object, map, name, instr->environment());
3182 } else { 3177 } else {
3183 Label next; 3178 Label next;
3184 bool compact = all_are_compact ? true : 3179 bool compact = all_are_compact ? true :
3185 CompactEmit(instr->hydrogen()->types(), name, i, isolate()); 3180 CompactEmit(instr->hydrogen()->types(), name, i, isolate());
3186 __ j(not_equal, &next, compact ? Label::kNear : Label::kFar); 3181 __ j(not_equal, &next, compact ? Label::kNear : Label::kFar);
3187 __ bind(&check_passed); 3182 __ bind(&check_passed);
3188 EmitLoadFieldOrConstantFunction( 3183 EmitLoadFieldOrConstant(result, object, map, name, instr->environment());
3189 result, object, map, name, instr->environment());
3190 __ jmp(&done, all_are_compact ? Label::kNear : Label::kFar); 3184 __ jmp(&done, all_are_compact ? Label::kNear : Label::kFar);
3191 __ bind(&next); 3185 __ bind(&next);
3192 } 3186 }
3193 } 3187 }
3194 if (need_generic) { 3188 if (need_generic) {
3195 __ mov(ecx, name); 3189 __ mov(ecx, name);
3196 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 3190 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
3197 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3191 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3198 } 3192 }
3199 __ bind(&done); 3193 __ bind(&done);
(...skipping 3301 matching lines...) Expand 10 before | Expand all | Expand 10 after
6501 FixedArray::kHeaderSize - kPointerSize)); 6495 FixedArray::kHeaderSize - kPointerSize));
6502 __ bind(&done); 6496 __ bind(&done);
6503 } 6497 }
6504 6498
6505 6499
6506 #undef __ 6500 #undef __
6507 6501
6508 } } // namespace v8::internal 6502 } } // namespace v8::internal
6509 6503
6510 #endif // V8_TARGET_ARCH_IA32 6504 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698