| 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 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 ASSERT(!scratch.is(ip)); | 1344 ASSERT(!scratch.is(ip)); |
| 1345 | 1345 |
| 1346 // Load current lexical context from the stack frame. | 1346 // Load current lexical context from the stack frame. |
| 1347 ldr(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1347 ldr(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1348 // In debug mode, make sure the lexical context is set. | 1348 // In debug mode, make sure the lexical context is set. |
| 1349 #ifdef DEBUG | 1349 #ifdef DEBUG |
| 1350 cmp(scratch, Operand(0, RelocInfo::NONE)); | 1350 cmp(scratch, Operand(0, RelocInfo::NONE)); |
| 1351 Check(ne, "we should not have an empty lexical context"); | 1351 Check(ne, "we should not have an empty lexical context"); |
| 1352 #endif | 1352 #endif |
| 1353 | 1353 |
| 1354 // Load the global context of the current context. | 1354 // Load the native context of the current context. |
| 1355 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; | 1355 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
| 1356 ldr(scratch, FieldMemOperand(scratch, offset)); | 1356 ldr(scratch, FieldMemOperand(scratch, offset)); |
| 1357 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); | 1357 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); |
| 1358 | 1358 |
| 1359 // Check the context is a global context. | 1359 // Check the context is a native context. |
| 1360 if (emit_debug_code()) { | 1360 if (emit_debug_code()) { |
| 1361 // TODO(119): avoid push(holder_reg)/pop(holder_reg) | 1361 // TODO(119): avoid push(holder_reg)/pop(holder_reg) |
| 1362 // Cannot use ip as a temporary in this verification code. Due to the fact | 1362 // Cannot use ip as a temporary in this verification code. Due to the fact |
| 1363 // that ip is clobbered as part of cmp with an object Operand. | 1363 // that ip is clobbered as part of cmp with an object Operand. |
| 1364 push(holder_reg); // Temporarily save holder on the stack. | 1364 push(holder_reg); // Temporarily save holder on the stack. |
| 1365 // Read the first word and compare to the global_context_map. | 1365 // Read the first word and compare to the native_context_map. |
| 1366 ldr(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); | 1366 ldr(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
| 1367 LoadRoot(ip, Heap::kGlobalContextMapRootIndex); | 1367 LoadRoot(ip, Heap::kNativeContextMapRootIndex); |
| 1368 cmp(holder_reg, ip); | 1368 cmp(holder_reg, ip); |
| 1369 Check(eq, "JSGlobalObject::global_context should be a global context."); | 1369 Check(eq, "JSGlobalObject::native_context should be a native context."); |
| 1370 pop(holder_reg); // Restore holder. | 1370 pop(holder_reg); // Restore holder. |
| 1371 } | 1371 } |
| 1372 | 1372 |
| 1373 // Check if both contexts are the same. | 1373 // Check if both contexts are the same. |
| 1374 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 1374 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
| 1375 cmp(scratch, Operand(ip)); | 1375 cmp(scratch, Operand(ip)); |
| 1376 b(eq, &same_contexts); | 1376 b(eq, &same_contexts); |
| 1377 | 1377 |
| 1378 // Check the context is a global context. | 1378 // Check the context is a native context. |
| 1379 if (emit_debug_code()) { | 1379 if (emit_debug_code()) { |
| 1380 // TODO(119): avoid push(holder_reg)/pop(holder_reg) | 1380 // TODO(119): avoid push(holder_reg)/pop(holder_reg) |
| 1381 // Cannot use ip as a temporary in this verification code. Due to the fact | 1381 // Cannot use ip as a temporary in this verification code. Due to the fact |
| 1382 // that ip is clobbered as part of cmp with an object Operand. | 1382 // that ip is clobbered as part of cmp with an object Operand. |
| 1383 push(holder_reg); // Temporarily save holder on the stack. | 1383 push(holder_reg); // Temporarily save holder on the stack. |
| 1384 mov(holder_reg, ip); // Move ip to its holding place. | 1384 mov(holder_reg, ip); // Move ip to its holding place. |
| 1385 LoadRoot(ip, Heap::kNullValueRootIndex); | 1385 LoadRoot(ip, Heap::kNullValueRootIndex); |
| 1386 cmp(holder_reg, ip); | 1386 cmp(holder_reg, ip); |
| 1387 Check(ne, "JSGlobalProxy::context() should not be null."); | 1387 Check(ne, "JSGlobalProxy::context() should not be null."); |
| 1388 | 1388 |
| 1389 ldr(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); | 1389 ldr(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); |
| 1390 LoadRoot(ip, Heap::kGlobalContextMapRootIndex); | 1390 LoadRoot(ip, Heap::kNativeContextMapRootIndex); |
| 1391 cmp(holder_reg, ip); | 1391 cmp(holder_reg, ip); |
| 1392 Check(eq, "JSGlobalObject::global_context should be a global context."); | 1392 Check(eq, "JSGlobalObject::native_context should be a native context."); |
| 1393 // Restore ip is not needed. ip is reloaded below. | 1393 // Restore ip is not needed. ip is reloaded below. |
| 1394 pop(holder_reg); // Restore holder. | 1394 pop(holder_reg); // Restore holder. |
| 1395 // Restore ip to holder's context. | 1395 // Restore ip to holder's context. |
| 1396 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 1396 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
| 1397 } | 1397 } |
| 1398 | 1398 |
| 1399 // Check that the security token in the calling global object is | 1399 // Check that the security token in the calling global object is |
| 1400 // compatible with the security token in the receiving global | 1400 // compatible with the security token in the receiving global |
| 1401 // object. | 1401 // object. |
| 1402 int token_offset = Context::kHeaderSize + | 1402 int token_offset = Context::kHeaderSize + |
| (...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2876 | 2876 |
| 2877 | 2877 |
| 2878 void MacroAssembler::LoadTransitionedArrayMapConditional( | 2878 void MacroAssembler::LoadTransitionedArrayMapConditional( |
| 2879 ElementsKind expected_kind, | 2879 ElementsKind expected_kind, |
| 2880 ElementsKind transitioned_kind, | 2880 ElementsKind transitioned_kind, |
| 2881 Register map_in_out, | 2881 Register map_in_out, |
| 2882 Register scratch, | 2882 Register scratch, |
| 2883 Label* no_map_match) { | 2883 Label* no_map_match) { |
| 2884 // Load the global or builtins object from the current context. | 2884 // Load the global or builtins object from the current context. |
| 2885 ldr(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2885 ldr(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 2886 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); | 2886 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); |
| 2887 | 2887 |
| 2888 // Check that the function's map is the same as the expected cached map. | 2888 // Check that the function's map is the same as the expected cached map. |
| 2889 ldr(scratch, | 2889 ldr(scratch, |
| 2890 MemOperand(scratch, | 2890 MemOperand(scratch, |
| 2891 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 2891 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
| 2892 size_t offset = expected_kind * kPointerSize + | 2892 size_t offset = expected_kind * kPointerSize + |
| 2893 FixedArrayBase::kHeaderSize; | 2893 FixedArrayBase::kHeaderSize; |
| 2894 ldr(ip, FieldMemOperand(scratch, offset)); | 2894 ldr(ip, FieldMemOperand(scratch, offset)); |
| 2895 cmp(map_in_out, ip); | 2895 cmp(map_in_out, ip); |
| 2896 b(ne, no_map_match); | 2896 b(ne, no_map_match); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2923 scratch, | 2923 scratch, |
| 2924 &done); | 2924 &done); |
| 2925 } | 2925 } |
| 2926 bind(&done); | 2926 bind(&done); |
| 2927 } | 2927 } |
| 2928 | 2928 |
| 2929 | 2929 |
| 2930 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 2930 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
| 2931 // Load the global or builtins object from the current context. | 2931 // Load the global or builtins object from the current context. |
| 2932 ldr(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2932 ldr(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 2933 // Load the global context from the global or builtins object. | 2933 // Load the native context from the global or builtins object. |
| 2934 ldr(function, FieldMemOperand(function, | 2934 ldr(function, FieldMemOperand(function, |
| 2935 GlobalObject::kGlobalContextOffset)); | 2935 GlobalObject::kNativeContextOffset)); |
| 2936 // Load the function from the global context. | 2936 // Load the function from the native context. |
| 2937 ldr(function, MemOperand(function, Context::SlotOffset(index))); | 2937 ldr(function, MemOperand(function, Context::SlotOffset(index))); |
| 2938 } | 2938 } |
| 2939 | 2939 |
| 2940 | 2940 |
| 2941 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 2941 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
| 2942 Register map, | 2942 Register map, |
| 2943 Register scratch) { | 2943 Register scratch) { |
| 2944 // Load the initial map. The global functions all have initial maps. | 2944 // Load the initial map. The global functions all have initial maps. |
| 2945 ldr(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 2945 ldr(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
| 2946 if (emit_debug_code()) { | 2946 if (emit_debug_code()) { |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3820 void CodePatcher::EmitCondition(Condition cond) { | 3820 void CodePatcher::EmitCondition(Condition cond) { |
| 3821 Instr instr = Assembler::instr_at(masm_.pc_); | 3821 Instr instr = Assembler::instr_at(masm_.pc_); |
| 3822 instr = (instr & ~kCondMask) | cond; | 3822 instr = (instr & ~kCondMask) | cond; |
| 3823 masm_.emit(instr); | 3823 masm_.emit(instr); |
| 3824 } | 3824 } |
| 3825 | 3825 |
| 3826 | 3826 |
| 3827 } } // namespace v8::internal | 3827 } } // namespace v8::internal |
| 3828 | 3828 |
| 3829 #endif // V8_TARGET_ARCH_ARM | 3829 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |