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 native context of the current context. | 1354 // Load the global context of the current context. |
1355 int offset = | 1355 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
1356 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | |
1357 ldr(scratch, FieldMemOperand(scratch, offset)); | 1356 ldr(scratch, FieldMemOperand(scratch, offset)); |
1358 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | 1357 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); |
1359 | 1358 |
1360 // Check the context is a native context. | 1359 // Check the context is a global context. |
1361 if (emit_debug_code()) { | 1360 if (emit_debug_code()) { |
1362 // TODO(119): avoid push(holder_reg)/pop(holder_reg) | 1361 // TODO(119): avoid push(holder_reg)/pop(holder_reg) |
1363 // 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 |
1364 // 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. |
1365 push(holder_reg); // Temporarily save holder on the stack. | 1364 push(holder_reg); // Temporarily save holder on the stack. |
1366 // Read the first word and compare to the native_context_map. | 1365 // Read the first word and compare to the global_context_map. |
1367 ldr(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); | 1366 ldr(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
1368 LoadRoot(ip, Heap::kNativeContextMapRootIndex); | 1367 LoadRoot(ip, Heap::kGlobalContextMapRootIndex); |
1369 cmp(holder_reg, ip); | 1368 cmp(holder_reg, ip); |
1370 Check(eq, "JSGlobalObject::native_context should be a native context."); | 1369 Check(eq, "JSGlobalObject::global_context should be a global context."); |
1371 pop(holder_reg); // Restore holder. | 1370 pop(holder_reg); // Restore holder. |
1372 } | 1371 } |
1373 | 1372 |
1374 // Check if both contexts are the same. | 1373 // Check if both contexts are the same. |
1375 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | 1374 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
1376 cmp(scratch, Operand(ip)); | 1375 cmp(scratch, Operand(ip)); |
1377 b(eq, &same_contexts); | 1376 b(eq, &same_contexts); |
1378 | 1377 |
1379 // Check the context is a native context. | 1378 // Check the context is a global context. |
1380 if (emit_debug_code()) { | 1379 if (emit_debug_code()) { |
1381 // TODO(119): avoid push(holder_reg)/pop(holder_reg) | 1380 // TODO(119): avoid push(holder_reg)/pop(holder_reg) |
1382 // 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 |
1383 // 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. |
1384 push(holder_reg); // Temporarily save holder on the stack. | 1383 push(holder_reg); // Temporarily save holder on the stack. |
1385 mov(holder_reg, ip); // Move ip to its holding place. | 1384 mov(holder_reg, ip); // Move ip to its holding place. |
1386 LoadRoot(ip, Heap::kNullValueRootIndex); | 1385 LoadRoot(ip, Heap::kNullValueRootIndex); |
1387 cmp(holder_reg, ip); | 1386 cmp(holder_reg, ip); |
1388 Check(ne, "JSGlobalProxy::context() should not be null."); | 1387 Check(ne, "JSGlobalProxy::context() should not be null."); |
1389 | 1388 |
1390 ldr(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); | 1389 ldr(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); |
1391 LoadRoot(ip, Heap::kNativeContextMapRootIndex); | 1390 LoadRoot(ip, Heap::kGlobalContextMapRootIndex); |
1392 cmp(holder_reg, ip); | 1391 cmp(holder_reg, ip); |
1393 Check(eq, "JSGlobalObject::native_context should be a native context."); | 1392 Check(eq, "JSGlobalObject::global_context should be a global context."); |
1394 // Restore ip is not needed. ip is reloaded below. | 1393 // Restore ip is not needed. ip is reloaded below. |
1395 pop(holder_reg); // Restore holder. | 1394 pop(holder_reg); // Restore holder. |
1396 // Restore ip to holder's context. | 1395 // Restore ip to holder's context. |
1397 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | 1396 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
1398 } | 1397 } |
1399 | 1398 |
1400 // Check that the security token in the calling global object is | 1399 // Check that the security token in the calling global object is |
1401 // compatible with the security token in the receiving global | 1400 // compatible with the security token in the receiving global |
1402 // object. | 1401 // object. |
1403 int token_offset = Context::kHeaderSize + | 1402 int token_offset = Context::kHeaderSize + |
1404 Context::SECURITY_TOKEN_INDEX * kPointerSize; | 1403 Context::SECURITY_TOKEN_INDEX * kPointerSize; |
1405 | 1404 |
1406 ldr(scratch, FieldMemOperand(scratch, token_offset)); | 1405 ldr(scratch, FieldMemOperand(scratch, token_offset)); |
1407 ldr(ip, FieldMemOperand(ip, token_offset)); | 1406 ldr(ip, FieldMemOperand(ip, token_offset)); |
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2710 ASSERT(flag == JUMP_FUNCTION); | 2709 ASSERT(flag == JUMP_FUNCTION); |
2711 SetCallKind(r5, CALL_AS_METHOD); | 2710 SetCallKind(r5, CALL_AS_METHOD); |
2712 Jump(r2); | 2711 Jump(r2); |
2713 } | 2712 } |
2714 } | 2713 } |
2715 | 2714 |
2716 | 2715 |
2717 void MacroAssembler::GetBuiltinFunction(Register target, | 2716 void MacroAssembler::GetBuiltinFunction(Register target, |
2718 Builtins::JavaScript id) { | 2717 Builtins::JavaScript id) { |
2719 // Load the builtins object into target register. | 2718 // Load the builtins object into target register. |
2720 ldr(target, | 2719 ldr(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
2721 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
2722 ldr(target, FieldMemOperand(target, GlobalObject::kBuiltinsOffset)); | 2720 ldr(target, FieldMemOperand(target, GlobalObject::kBuiltinsOffset)); |
2723 // Load the JavaScript builtin function from the builtins object. | 2721 // Load the JavaScript builtin function from the builtins object. |
2724 ldr(target, FieldMemOperand(target, | 2722 ldr(target, FieldMemOperand(target, |
2725 JSBuiltinsObject::OffsetOfFunctionWithId(id))); | 2723 JSBuiltinsObject::OffsetOfFunctionWithId(id))); |
2726 } | 2724 } |
2727 | 2725 |
2728 | 2726 |
2729 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { | 2727 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { |
2730 ASSERT(!target.is(r1)); | 2728 ASSERT(!target.is(r1)); |
2731 GetBuiltinFunction(r1, id); | 2729 GetBuiltinFunction(r1, id); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2877 } | 2875 } |
2878 | 2876 |
2879 | 2877 |
2880 void MacroAssembler::LoadTransitionedArrayMapConditional( | 2878 void MacroAssembler::LoadTransitionedArrayMapConditional( |
2881 ElementsKind expected_kind, | 2879 ElementsKind expected_kind, |
2882 ElementsKind transitioned_kind, | 2880 ElementsKind transitioned_kind, |
2883 Register map_in_out, | 2881 Register map_in_out, |
2884 Register scratch, | 2882 Register scratch, |
2885 Label* no_map_match) { | 2883 Label* no_map_match) { |
2886 // Load the global or builtins object from the current context. | 2884 // Load the global or builtins object from the current context. |
2887 ldr(scratch, | 2885 ldr(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
2888 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2886 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); |
2889 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | |
2890 | 2887 |
2891 // 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. |
2892 ldr(scratch, | 2889 ldr(scratch, |
2893 MemOperand(scratch, | 2890 MemOperand(scratch, |
2894 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 2891 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
2895 size_t offset = expected_kind * kPointerSize + | 2892 size_t offset = expected_kind * kPointerSize + |
2896 FixedArrayBase::kHeaderSize; | 2893 FixedArrayBase::kHeaderSize; |
2897 ldr(ip, FieldMemOperand(scratch, offset)); | 2894 ldr(ip, FieldMemOperand(scratch, offset)); |
2898 cmp(map_in_out, ip); | 2895 cmp(map_in_out, ip); |
2899 b(ne, no_map_match); | 2896 b(ne, no_map_match); |
(...skipping 25 matching lines...) Expand all Loading... |
2925 map_out, | 2922 map_out, |
2926 scratch, | 2923 scratch, |
2927 &done); | 2924 &done); |
2928 } | 2925 } |
2929 bind(&done); | 2926 bind(&done); |
2930 } | 2927 } |
2931 | 2928 |
2932 | 2929 |
2933 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 2930 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
2934 // Load the global or builtins object from the current context. | 2931 // Load the global or builtins object from the current context. |
2935 ldr(function, | 2932 ldr(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
2936 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2933 // Load the global context from the global or builtins object. |
2937 // Load the native context from the global or builtins object. | |
2938 ldr(function, FieldMemOperand(function, | 2934 ldr(function, FieldMemOperand(function, |
2939 GlobalObject::kNativeContextOffset)); | 2935 GlobalObject::kGlobalContextOffset)); |
2940 // Load the function from the native context. | 2936 // Load the function from the global context. |
2941 ldr(function, MemOperand(function, Context::SlotOffset(index))); | 2937 ldr(function, MemOperand(function, Context::SlotOffset(index))); |
2942 } | 2938 } |
2943 | 2939 |
2944 | 2940 |
2945 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 2941 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
2946 Register map, | 2942 Register map, |
2947 Register scratch) { | 2943 Register scratch) { |
2948 // Load the initial map. The global functions all have initial maps. | 2944 // Load the initial map. The global functions all have initial maps. |
2949 ldr(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 2945 ldr(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
2950 if (emit_debug_code()) { | 2946 if (emit_debug_code()) { |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3824 void CodePatcher::EmitCondition(Condition cond) { | 3820 void CodePatcher::EmitCondition(Condition cond) { |
3825 Instr instr = Assembler::instr_at(masm_.pc_); | 3821 Instr instr = Assembler::instr_at(masm_.pc_); |
3826 instr = (instr & ~kCondMask) | cond; | 3822 instr = (instr & ~kCondMask) | cond; |
3827 masm_.emit(instr); | 3823 masm_.emit(instr); |
3828 } | 3824 } |
3829 | 3825 |
3830 | 3826 |
3831 } } // namespace v8::internal | 3827 } } // namespace v8::internal |
3832 | 3828 |
3833 #endif // V8_TARGET_ARCH_ARM | 3829 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |