Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 5247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5258 CodeGenerator* cgen = generator(); | 5258 CodeGenerator* cgen = generator(); |
| 5259 Result receiver(cgen); | 5259 Result receiver(cgen); |
| 5260 enter()->Bind(&receiver); | 5260 enter()->Bind(&receiver); |
| 5261 | 5261 |
| 5262 cgen->frame()->Push(&receiver); | 5262 cgen->frame()->Push(&receiver); |
| 5263 cgen->frame()->Push(name_); | 5263 cgen->frame()->Push(name_); |
| 5264 Result answer = cgen->frame()->CallLoadIC(RelocInfo::CODE_TARGET); | 5264 Result answer = cgen->frame()->CallLoadIC(RelocInfo::CODE_TARGET); |
| 5265 // The call must be followed by a test eax instruction to indicate | 5265 // The call must be followed by a test eax instruction to indicate |
| 5266 // that the inobject property case was inlined. | 5266 // that the inobject property case was inlined. |
| 5267 ASSERT(answer.is_register() && answer.reg().is(eax)); | 5267 ASSERT(answer.is_register() && answer.reg().is(eax)); |
| 5268 // Store the delta to the map check instruction here in the test | 5268 // Store the delta to the map check instruction here in the test instruction. |
| 5269 // instruction. | 5269 // Use masm_-> instead of the double underscore macro since the latter can't |
| 5270 int delta_to_patch_site = __ SizeOfCodeGeneratedSince(patch_site()); | 5270 // return a value. |
| 5271 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | |
| 5271 // Here we use masm_-> instead of the double underscore macro because | 5272 // Here we use masm_-> instead of the double underscore macro because |
| 5272 // this is the instruction that gets patched and coverage code gets in | 5273 // this is the instruction that gets patched and coverage code gets in |
| 5273 // the way. | 5274 // the way. |
| 5274 masm_->test(answer.reg(), Immediate(-delta_to_patch_site)); | 5275 masm_->test(answer.reg(), Immediate(-delta_to_patch_site)); |
| 5275 __ IncrementCounter(&Counters::named_load_inline_miss, 1); | 5276 __ IncrementCounter(&Counters::named_load_inline_miss, 1); |
| 5276 receiver = cgen->frame()->Pop(); | 5277 receiver = cgen->frame()->Pop(); |
| 5277 exit_.Jump(&receiver, &answer); | 5278 exit_.Jump(&receiver, &answer); |
| 5278 } | 5279 } |
| 5279 | 5280 |
| 5280 | 5281 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5410 deferred->enter()->Branch(zero, &receiver, not_taken); | 5411 deferred->enter()->Branch(zero, &receiver, not_taken); |
| 5411 | 5412 |
| 5412 // Preallocate the value register to ensure that there is no | 5413 // Preallocate the value register to ensure that there is no |
| 5413 // spill emitted between the patch site label and the offset in | 5414 // spill emitted between the patch site label and the offset in |
| 5414 // the load instruction. | 5415 // the load instruction. |
| 5415 Result value = cgen_->allocator()->Allocate(); | 5416 Result value = cgen_->allocator()->Allocate(); |
| 5416 ASSERT(value.is_valid()); | 5417 ASSERT(value.is_valid()); |
| 5417 __ bind(deferred->patch_site()); | 5418 __ bind(deferred->patch_site()); |
| 5418 // This is the map check instruction that will be patched. | 5419 // This is the map check instruction that will be patched. |
| 5419 // Initially use an invalid map to force a failure. | 5420 // Initially use an invalid map to force a failure. |
| 5420 __ cmp(FieldOperand(receiver.reg(), HeapObject::kMapOffset), | 5421 masm->cmp(FieldOperand(receiver.reg(), HeapObject::kMapOffset), |
| 5421 Immediate(Factory::null_value())); | 5422 Immediate(Factory::null_value())); |
| 5423 // This branch is always a forwards branch so it's always a fixed | |
| 5424 // size which allows the assert below to succeed and patching to work. | |
|
William Hesse
2009/04/29 09:56:46
Should you explain the motivation for these other
| |
| 5422 deferred->enter()->Branch(not_equal, &receiver, not_taken); | 5425 deferred->enter()->Branch(not_equal, &receiver, not_taken); |
| 5423 | 5426 |
| 5424 // The delta from the patch label to the load offset must be | 5427 // The delta from the patch label to the load offset must be |
| 5425 // statically known. | 5428 // statically known. |
| 5426 ASSERT(masm->SizeOfCodeGeneratedSince(deferred->patch_site()) == | 5429 ASSERT(masm->SizeOfCodeGeneratedSince(deferred->patch_site()) == |
| 5427 LoadIC::kOffsetToLoadInstruction); | 5430 LoadIC::kOffsetToLoadInstruction); |
| 5428 // The initial (invalid) offset has to be large enough to force | 5431 // The initial (invalid) offset has to be large enough to force |
| 5429 // a 32-bit instruction encoding to allow patching with an | 5432 // a 32-bit instruction encoding to allow patching with an |
| 5430 // arbitrary offset. Use kMaxInt (minus kHeapObjectTag). | 5433 // arbitrary offset. Use kMaxInt (minus kHeapObjectTag). |
| 5431 int offset = kMaxInt; | 5434 int offset = kMaxInt; |
| 5432 __ mov(value.reg(), FieldOperand(receiver.reg(), offset)); | 5435 masm->mov(value.reg(), FieldOperand(receiver.reg(), offset)); |
| 5433 | 5436 |
| 5434 __ IncrementCounter(&Counters::named_load_inline, 1); | 5437 __ IncrementCounter(&Counters::named_load_inline, 1); |
| 5435 deferred->BindExit(&receiver, &value); | 5438 deferred->BindExit(&receiver, &value); |
| 5436 cgen_->frame()->Push(&receiver); | 5439 cgen_->frame()->Push(&receiver); |
| 5437 cgen_->frame()->Push(&value); | 5440 cgen_->frame()->Push(&value); |
| 5438 } | 5441 } |
| 5439 break; | 5442 break; |
| 5440 } | 5443 } |
| 5441 | 5444 |
| 5442 case KEYED: { | 5445 case KEYED: { |
| (...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7213 | 7216 |
| 7214 // Slow-case: Go through the JavaScript implementation. | 7217 // Slow-case: Go through the JavaScript implementation. |
| 7215 __ bind(&slow); | 7218 __ bind(&slow); |
| 7216 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 7219 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 7217 } | 7220 } |
| 7218 | 7221 |
| 7219 | 7222 |
| 7220 #undef __ | 7223 #undef __ |
| 7221 | 7224 |
| 7222 } } // namespace v8::internal | 7225 } } // namespace v8::internal |
| OLD | NEW |