OLD | NEW |
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 4016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4027 // not agree). A variable occurring in such a scope should have | 4027 // not agree). A variable occurring in such a scope should have |
4028 // slot type LOOKUP and not CONTEXT. | 4028 // slot type LOOKUP and not CONTEXT. |
4029 if (emit_debug_code()) { | 4029 if (emit_debug_code()) { |
4030 CompareRoot(FieldOperand(dst, HeapObject::kMapOffset), | 4030 CompareRoot(FieldOperand(dst, HeapObject::kMapOffset), |
4031 Heap::kWithContextMapRootIndex); | 4031 Heap::kWithContextMapRootIndex); |
4032 Check(not_equal, "Variable resolved to with context."); | 4032 Check(not_equal, "Variable resolved to with context."); |
4033 } | 4033 } |
4034 } | 4034 } |
4035 | 4035 |
4036 | 4036 |
4037 void MacroAssembler::LoadGlobalInitialConstructedArrayMap( | 4037 void MacroAssembler::LoadTransitionedArrayMapConditional( |
| 4038 ElementsKind expected_kind, |
| 4039 ElementsKind transitioned_kind, |
| 4040 Register map_in_out, |
| 4041 Register scratch, |
| 4042 Label* no_map_match) { |
| 4043 // Load the global or builtins object from the current context. |
| 4044 movq(scratch, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 4045 movq(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); |
| 4046 |
| 4047 // Check that the function's map is the same as the expected cached map. |
| 4048 int expected_index = |
| 4049 Context::GetContextMapIndexFromElementsKind(expected_kind); |
| 4050 cmpq(map_in_out, Operand(scratch, Context::SlotOffset(expected_index))); |
| 4051 j(not_equal, no_map_match); |
| 4052 |
| 4053 // Use the transitioned cached map. |
| 4054 int trans_index = |
| 4055 Context::GetContextMapIndexFromElementsKind(transitioned_kind); |
| 4056 movq(map_in_out, Operand(scratch, Context::SlotOffset(trans_index))); |
| 4057 } |
| 4058 |
| 4059 |
| 4060 void MacroAssembler::LoadInitialArrayMap( |
4038 Register function_in, Register scratch, Register map_out) { | 4061 Register function_in, Register scratch, Register map_out) { |
4039 ASSERT(!function_in.is(map_out)); | 4062 ASSERT(!function_in.is(map_out)); |
4040 Label done; | 4063 Label done; |
4041 movq(map_out, FieldOperand(function_in, | 4064 movq(map_out, FieldOperand(function_in, |
4042 JSFunction::kPrototypeOrInitialMapOffset)); | 4065 JSFunction::kPrototypeOrInitialMapOffset)); |
4043 if (!FLAG_smi_only_arrays) { | 4066 if (!FLAG_smi_only_arrays) { |
4044 // Load the global or builtins object from the current context. | 4067 LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, |
4045 movq(scratch, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 4068 FAST_ELEMENTS, |
4046 movq(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); | 4069 map_out, |
4047 | 4070 scratch, |
4048 // Check that the function's map is same as the cached map. | 4071 &done); |
4049 cmpq(map_out, | |
4050 Operand(scratch, | |
4051 Context::SlotOffset(Context::SMI_JS_ARRAY_MAP_INDEX))); | |
4052 j(not_equal, &done); | |
4053 | |
4054 // Use the cached transitioned map. | |
4055 movq(map_out, | |
4056 Operand(scratch, | |
4057 Context::SlotOffset(Context::OBJECT_JS_ARRAY_MAP_INDEX))); | |
4058 } | 4072 } |
4059 bind(&done); | 4073 bind(&done); |
4060 } | 4074 } |
4061 | 4075 |
4062 #ifdef _WIN64 | 4076 #ifdef _WIN64 |
4063 static const int kRegisterPassedArguments = 4; | 4077 static const int kRegisterPassedArguments = 4; |
4064 #else | 4078 #else |
4065 static const int kRegisterPassedArguments = 6; | 4079 static const int kRegisterPassedArguments = 6; |
4066 #endif | 4080 #endif |
4067 | 4081 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4364 | 4378 |
4365 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); | 4379 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); |
4366 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); | 4380 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); |
4367 | 4381 |
4368 bind(&done); | 4382 bind(&done); |
4369 } | 4383 } |
4370 | 4384 |
4371 } } // namespace v8::internal | 4385 } } // namespace v8::internal |
4372 | 4386 |
4373 #endif // V8_TARGET_ARCH_X64 | 4387 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |