| 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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 ASSERT(!holder_reg.is(scratch)); | 975 ASSERT(!holder_reg.is(scratch)); |
| 976 | 976 |
| 977 // Load current lexical context from the stack frame. | 977 // Load current lexical context from the stack frame. |
| 978 mov(scratch, Operand(ebp, StandardFrameConstants::kContextOffset)); | 978 mov(scratch, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 979 | 979 |
| 980 // When generating debug code, make sure the lexical context is set. | 980 // When generating debug code, make sure the lexical context is set. |
| 981 if (emit_debug_code()) { | 981 if (emit_debug_code()) { |
| 982 cmp(scratch, Immediate(0)); | 982 cmp(scratch, Immediate(0)); |
| 983 Check(not_equal, "we should not have an empty lexical context"); | 983 Check(not_equal, "we should not have an empty lexical context"); |
| 984 } | 984 } |
| 985 // Load the global context of the current context. | 985 // Load the native context of the current context. |
| 986 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; | 986 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
| 987 mov(scratch, FieldOperand(scratch, offset)); | 987 mov(scratch, FieldOperand(scratch, offset)); |
| 988 mov(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); | 988 mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); |
| 989 | 989 |
| 990 // Check the context is a global context. | 990 // Check the context is a native context. |
| 991 if (emit_debug_code()) { | 991 if (emit_debug_code()) { |
| 992 push(scratch); | 992 push(scratch); |
| 993 // Read the first word and compare to global_context_map. | 993 // Read the first word and compare to native_context_map. |
| 994 mov(scratch, FieldOperand(scratch, HeapObject::kMapOffset)); | 994 mov(scratch, FieldOperand(scratch, HeapObject::kMapOffset)); |
| 995 cmp(scratch, isolate()->factory()->global_context_map()); | 995 cmp(scratch, isolate()->factory()->native_context_map()); |
| 996 Check(equal, "JSGlobalObject::global_context should be a global context."); | 996 Check(equal, "JSGlobalObject::native_context should be a native context."); |
| 997 pop(scratch); | 997 pop(scratch); |
| 998 } | 998 } |
| 999 | 999 |
| 1000 // Check if both contexts are the same. | 1000 // Check if both contexts are the same. |
| 1001 cmp(scratch, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 1001 cmp(scratch, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
| 1002 j(equal, &same_contexts); | 1002 j(equal, &same_contexts); |
| 1003 | 1003 |
| 1004 // Compare security tokens, save holder_reg on the stack so we can use it | 1004 // Compare security tokens, save holder_reg on the stack so we can use it |
| 1005 // as a temporary register. | 1005 // as a temporary register. |
| 1006 // | 1006 // |
| 1007 // TODO(119): avoid push(holder_reg)/pop(holder_reg) | 1007 // TODO(119): avoid push(holder_reg)/pop(holder_reg) |
| 1008 push(holder_reg); | 1008 push(holder_reg); |
| 1009 // Check that the security token in the calling global object is | 1009 // Check that the security token in the calling global object is |
| 1010 // compatible with the security token in the receiving global | 1010 // compatible with the security token in the receiving global |
| 1011 // object. | 1011 // object. |
| 1012 mov(holder_reg, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 1012 mov(holder_reg, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
| 1013 | 1013 |
| 1014 // Check the context is a global context. | 1014 // Check the context is a native context. |
| 1015 if (emit_debug_code()) { | 1015 if (emit_debug_code()) { |
| 1016 cmp(holder_reg, isolate()->factory()->null_value()); | 1016 cmp(holder_reg, isolate()->factory()->null_value()); |
| 1017 Check(not_equal, "JSGlobalProxy::context() should not be null."); | 1017 Check(not_equal, "JSGlobalProxy::context() should not be null."); |
| 1018 | 1018 |
| 1019 push(holder_reg); | 1019 push(holder_reg); |
| 1020 // Read the first word and compare to global_context_map(), | 1020 // Read the first word and compare to native_context_map(), |
| 1021 mov(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset)); | 1021 mov(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset)); |
| 1022 cmp(holder_reg, isolate()->factory()->global_context_map()); | 1022 cmp(holder_reg, isolate()->factory()->native_context_map()); |
| 1023 Check(equal, "JSGlobalObject::global_context should be a global context."); | 1023 Check(equal, "JSGlobalObject::native_context should be a native context."); |
| 1024 pop(holder_reg); | 1024 pop(holder_reg); |
| 1025 } | 1025 } |
| 1026 | 1026 |
| 1027 int token_offset = Context::kHeaderSize + | 1027 int token_offset = Context::kHeaderSize + |
| 1028 Context::SECURITY_TOKEN_INDEX * kPointerSize; | 1028 Context::SECURITY_TOKEN_INDEX * kPointerSize; |
| 1029 mov(scratch, FieldOperand(scratch, token_offset)); | 1029 mov(scratch, FieldOperand(scratch, token_offset)); |
| 1030 cmp(scratch, FieldOperand(holder_reg, token_offset)); | 1030 cmp(scratch, FieldOperand(holder_reg, token_offset)); |
| 1031 pop(holder_reg); | 1031 pop(holder_reg); |
| 1032 j(not_equal, miss); | 1032 j(not_equal, miss); |
| 1033 | 1033 |
| (...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 | 2213 |
| 2214 | 2214 |
| 2215 void MacroAssembler::LoadTransitionedArrayMapConditional( | 2215 void MacroAssembler::LoadTransitionedArrayMapConditional( |
| 2216 ElementsKind expected_kind, | 2216 ElementsKind expected_kind, |
| 2217 ElementsKind transitioned_kind, | 2217 ElementsKind transitioned_kind, |
| 2218 Register map_in_out, | 2218 Register map_in_out, |
| 2219 Register scratch, | 2219 Register scratch, |
| 2220 Label* no_map_match) { | 2220 Label* no_map_match) { |
| 2221 // Load the global or builtins object from the current context. | 2221 // Load the global or builtins object from the current context. |
| 2222 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2222 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 2223 mov(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); | 2223 mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); |
| 2224 | 2224 |
| 2225 // Check that the function's map is the same as the expected cached map. | 2225 // Check that the function's map is the same as the expected cached map. |
| 2226 mov(scratch, Operand(scratch, | 2226 mov(scratch, Operand(scratch, |
| 2227 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 2227 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
| 2228 | 2228 |
| 2229 size_t offset = expected_kind * kPointerSize + | 2229 size_t offset = expected_kind * kPointerSize + |
| 2230 FixedArrayBase::kHeaderSize; | 2230 FixedArrayBase::kHeaderSize; |
| 2231 cmp(map_in_out, FieldOperand(scratch, offset)); | 2231 cmp(map_in_out, FieldOperand(scratch, offset)); |
| 2232 j(not_equal, no_map_match); | 2232 j(not_equal, no_map_match); |
| 2233 | 2233 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2259 scratch, | 2259 scratch, |
| 2260 &done); | 2260 &done); |
| 2261 } | 2261 } |
| 2262 bind(&done); | 2262 bind(&done); |
| 2263 } | 2263 } |
| 2264 | 2264 |
| 2265 | 2265 |
| 2266 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 2266 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
| 2267 // Load the global or builtins object from the current context. | 2267 // Load the global or builtins object from the current context. |
| 2268 mov(function, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2268 mov(function, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 2269 // Load the global context from the global or builtins object. | 2269 // Load the native context from the global or builtins object. |
| 2270 mov(function, FieldOperand(function, GlobalObject::kGlobalContextOffset)); | 2270 mov(function, FieldOperand(function, GlobalObject::kNativeContextOffset)); |
| 2271 // Load the function from the global context. | 2271 // Load the function from the native context. |
| 2272 mov(function, Operand(function, Context::SlotOffset(index))); | 2272 mov(function, Operand(function, Context::SlotOffset(index))); |
| 2273 } | 2273 } |
| 2274 | 2274 |
| 2275 | 2275 |
| 2276 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 2276 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
| 2277 Register map) { | 2277 Register map) { |
| 2278 // Load the initial map. The global functions all have initial maps. | 2278 // Load the initial map. The global functions all have initial maps. |
| 2279 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 2279 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
| 2280 if (emit_debug_code()) { | 2280 if (emit_debug_code()) { |
| 2281 Label ok, fail; | 2281 Label ok, fail; |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2921 // Load the prototype from the map and loop if non-null. | 2921 // Load the prototype from the map and loop if non-null. |
| 2922 bind(&check_prototype); | 2922 bind(&check_prototype); |
| 2923 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); | 2923 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); |
| 2924 cmp(ecx, isolate()->factory()->null_value()); | 2924 cmp(ecx, isolate()->factory()->null_value()); |
| 2925 j(not_equal, &next); | 2925 j(not_equal, &next); |
| 2926 } | 2926 } |
| 2927 | 2927 |
| 2928 } } // namespace v8::internal | 2928 } } // namespace v8::internal |
| 2929 | 2929 |
| 2930 #endif // V8_TARGET_ARCH_IA32 | 2930 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |