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

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 11365221: Allow property indexes to refer to slots inside the object header. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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/ic.cc » ('j') | src/property.h » ('J')
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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 369 }
370 370
371 371
372 // Load a fast property out of a holder object (src). In-object properties 372 // Load a fast property out of a holder object (src). In-object properties
373 // are loaded directly otherwise the property is loaded from the properties 373 // are loaded directly otherwise the property is loaded from the properties
374 // fixed array. 374 // fixed array.
375 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm, 375 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm,
376 Register dst, 376 Register dst,
377 Register src, 377 Register src,
378 Handle<JSObject> holder, 378 Handle<JSObject> holder,
379 int index) { 379 PropertyIndex index) {
380 // Adjust for the number of properties stored in the holder. 380 if (index.IsHeaderIndex()) {
381 index -= holder->map()->inobject_properties(); 381 int offset = index.HeaderIndex() * kPointerSize;
382 if (index < 0) {
383 // Get the property straight out of the holder.
384 int offset = holder->map()->instance_size() + (index * kPointerSize);
385 __ mov(dst, FieldOperand(src, offset)); 382 __ mov(dst, FieldOperand(src, offset));
386 } else { 383 } else {
387 // Calculate the offset into the properties array. 384 // Adjust for the number of properties stored in the holder.
388 int offset = index * kPointerSize + FixedArray::kHeaderSize; 385 int slot = index.FieldIndex() - holder->map()->inobject_properties();
389 __ mov(dst, FieldOperand(src, JSObject::kPropertiesOffset)); 386 if (slot < 0) {
390 __ mov(dst, FieldOperand(dst, offset)); 387 // Get the property straight out of the holder.
388 int offset = holder->map()->instance_size() + (slot * kPointerSize);
389 __ mov(dst, FieldOperand(src, offset));
390 } else {
391 // Calculate the offset into the properties array.
392 int offset = slot * kPointerSize + FixedArray::kHeaderSize;
393 __ mov(dst, FieldOperand(src, JSObject::kPropertiesOffset));
394 __ mov(dst, FieldOperand(dst, offset));
395 }
391 } 396 }
392 } 397 }
393 398
394 399
395 static void PushInterceptorArguments(MacroAssembler* masm, 400 static void PushInterceptorArguments(MacroAssembler* masm,
396 Register receiver, 401 Register receiver,
397 Register holder, 402 Register holder,
398 Register name, 403 Register name,
399 Handle<JSObject> holder_obj) { 404 Handle<JSObject> holder_obj) {
400 __ push(name); 405 __ push(name);
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 return reg; 1034 return reg;
1030 } 1035 }
1031 1036
1032 1037
1033 void StubCompiler::GenerateLoadField(Handle<JSObject> object, 1038 void StubCompiler::GenerateLoadField(Handle<JSObject> object,
1034 Handle<JSObject> holder, 1039 Handle<JSObject> holder,
1035 Register receiver, 1040 Register receiver,
1036 Register scratch1, 1041 Register scratch1,
1037 Register scratch2, 1042 Register scratch2,
1038 Register scratch3, 1043 Register scratch3,
1039 int index, 1044 PropertyIndex index,
1040 Handle<String> name, 1045 Handle<String> name,
1041 Label* miss) { 1046 Label* miss) {
1042 // Check that the receiver isn't a smi. 1047 // Check that the receiver isn't a smi.
1043 __ JumpIfSmi(receiver, miss); 1048 __ JumpIfSmi(receiver, miss);
1044 1049
1045 // Check the prototype chain. 1050 // Check the prototype chain.
1046 Register reg = CheckPrototypes( 1051 Register reg = CheckPrototypes(
1047 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); 1052 object, receiver, holder, scratch1, scratch2, scratch3, name, miss);
1048 1053
1049 // Get the value from the properties. 1054 // Get the value from the properties.
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 Handle<Code> code = 1421 Handle<Code> code =
1417 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(), 1422 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(),
1418 kind_, 1423 kind_,
1419 extra_state_); 1424 extra_state_);
1420 __ jmp(code, RelocInfo::CODE_TARGET); 1425 __ jmp(code, RelocInfo::CODE_TARGET);
1421 } 1426 }
1422 1427
1423 1428
1424 Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object, 1429 Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object,
1425 Handle<JSObject> holder, 1430 Handle<JSObject> holder,
1426 int index, 1431 PropertyIndex index,
1427 Handle<String> name) { 1432 Handle<String> name) {
1428 // ----------- S t a t e ------------- 1433 // ----------- S t a t e -------------
1429 // -- ecx : name 1434 // -- ecx : name
1430 // -- esp[0] : return address 1435 // -- esp[0] : return address
1431 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 1436 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1432 // -- ... 1437 // -- ...
1433 // -- esp[(argc + 1) * 4] : receiver 1438 // -- esp[(argc + 1) * 4] : receiver
1434 // ----------------------------------- 1439 // -----------------------------------
1435 Label miss; 1440 Label miss;
1436 1441
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after
2949 __ bind(&miss); 2954 __ bind(&miss);
2950 GenerateLoadMiss(masm(), Code::LOAD_IC); 2955 GenerateLoadMiss(masm(), Code::LOAD_IC);
2951 2956
2952 // Return the generated code. 2957 // Return the generated code.
2953 return GetCode(Code::NONEXISTENT, factory()->empty_string()); 2958 return GetCode(Code::NONEXISTENT, factory()->empty_string());
2954 } 2959 }
2955 2960
2956 2961
2957 Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object, 2962 Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object,
2958 Handle<JSObject> holder, 2963 Handle<JSObject> holder,
2959 int index, 2964 PropertyIndex index,
2960 Handle<String> name) { 2965 Handle<String> name) {
2961 // ----------- S t a t e ------------- 2966 // ----------- S t a t e -------------
2962 // -- ecx : name 2967 // -- ecx : name
2963 // -- edx : receiver 2968 // -- edx : receiver
2964 // -- esp[0] : return address 2969 // -- esp[0] : return address
2965 // ----------------------------------- 2970 // -----------------------------------
2966 Label miss; 2971 Label miss;
2967 2972
2968 GenerateLoadField(object, holder, edx, ebx, eax, edi, index, name, &miss); 2973 GenerateLoadField(object, holder, edx, ebx, eax, edi, index, name, &miss);
2969 __ bind(&miss); 2974 __ bind(&miss);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3149 GenerateLoadMiss(masm(), Code::LOAD_IC); 3154 GenerateLoadMiss(masm(), Code::LOAD_IC);
3150 3155
3151 // Return the generated code. 3156 // Return the generated code.
3152 return GetCode(Code::NORMAL, name); 3157 return GetCode(Code::NORMAL, name);
3153 } 3158 }
3154 3159
3155 3160
3156 Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name, 3161 Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name,
3157 Handle<JSObject> receiver, 3162 Handle<JSObject> receiver,
3158 Handle<JSObject> holder, 3163 Handle<JSObject> holder,
3159 int index) { 3164 PropertyIndex index) {
3160 // ----------- S t a t e ------------- 3165 // ----------- S t a t e -------------
3161 // -- ecx : key 3166 // -- ecx : key
3162 // -- edx : receiver 3167 // -- edx : receiver
3163 // -- esp[0] : return address 3168 // -- esp[0] : return address
3164 // ----------------------------------- 3169 // -----------------------------------
3165 Label miss; 3170 Label miss;
3166 3171
3167 Counters* counters = isolate()->counters(); 3172 Counters* counters = isolate()->counters();
3168 __ IncrementCounter(counters->keyed_load_field(), 1); 3173 __ IncrementCounter(counters->keyed_load_field(), 1);
3169 3174
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
4357 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 4362 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
4358 } 4363 }
4359 } 4364 }
4360 4365
4361 4366
4362 #undef __ 4367 #undef __
4363 4368
4364 } } // namespace v8::internal 4369 } } // namespace v8::internal
4365 4370
4366 #endif // V8_TARGET_ARCH_IA32 4371 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/ic.cc » ('j') | src/property.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698