| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 | 1217 |
| 1218 | 1218 |
| 1219 void MacroAssembler::PopStackHandler() { | 1219 void MacroAssembler::PopStackHandler() { |
| 1220 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 1220 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
| 1221 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); | 1221 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); |
| 1222 pop(Operand::StaticVariable(handler_address)); | 1222 pop(Operand::StaticVariable(handler_address)); |
| 1223 add(esp, Immediate(StackHandlerConstants::kSize - kPointerSize)); | 1223 add(esp, Immediate(StackHandlerConstants::kSize - kPointerSize)); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 | 1226 |
| 1227 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, | |
| 1228 Register scratch1, | |
| 1229 Register scratch2, | |
| 1230 Label* miss) { | |
| 1231 Label same_contexts; | |
| 1232 | |
| 1233 DCHECK(!holder_reg.is(scratch1)); | |
| 1234 DCHECK(!holder_reg.is(scratch2)); | |
| 1235 DCHECK(!scratch1.is(scratch2)); | |
| 1236 | |
| 1237 // Load current lexical context from the active StandardFrame, which | |
| 1238 // may require crawling past STUB frames. | |
| 1239 Label load_context; | |
| 1240 Label has_context; | |
| 1241 mov(scratch2, ebp); | |
| 1242 bind(&load_context); | |
| 1243 mov(scratch1, | |
| 1244 MemOperand(scratch2, CommonFrameConstants::kContextOrFrameTypeOffset)); | |
| 1245 JumpIfNotSmi(scratch1, &has_context); | |
| 1246 mov(scratch2, MemOperand(scratch2, CommonFrameConstants::kCallerFPOffset)); | |
| 1247 jmp(&load_context); | |
| 1248 bind(&has_context); | |
| 1249 | |
| 1250 // When generating debug code, make sure the lexical context is set. | |
| 1251 if (emit_debug_code()) { | |
| 1252 cmp(scratch1, Immediate(0)); | |
| 1253 Check(not_equal, kWeShouldNotHaveAnEmptyLexicalContext); | |
| 1254 } | |
| 1255 // Load the native context of the current context. | |
| 1256 mov(scratch1, ContextOperand(scratch1, Context::NATIVE_CONTEXT_INDEX)); | |
| 1257 | |
| 1258 // Check the context is a native context. | |
| 1259 if (emit_debug_code()) { | |
| 1260 // Read the first word and compare to native_context_map. | |
| 1261 cmp(FieldOperand(scratch1, HeapObject::kMapOffset), | |
| 1262 isolate()->factory()->native_context_map()); | |
| 1263 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext); | |
| 1264 } | |
| 1265 | |
| 1266 // Check if both contexts are the same. | |
| 1267 cmp(scratch1, FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
| 1268 j(equal, &same_contexts); | |
| 1269 | |
| 1270 // Compare security tokens, save holder_reg on the stack so we can use it | |
| 1271 // as a temporary register. | |
| 1272 // | |
| 1273 // Check that the security token in the calling global object is | |
| 1274 // compatible with the security token in the receiving global | |
| 1275 // object. | |
| 1276 mov(scratch2, | |
| 1277 FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
| 1278 | |
| 1279 // Check the context is a native context. | |
| 1280 if (emit_debug_code()) { | |
| 1281 cmp(scratch2, isolate()->factory()->null_value()); | |
| 1282 Check(not_equal, kJSGlobalProxyContextShouldNotBeNull); | |
| 1283 | |
| 1284 // Read the first word and compare to native_context_map(), | |
| 1285 cmp(FieldOperand(scratch2, HeapObject::kMapOffset), | |
| 1286 isolate()->factory()->native_context_map()); | |
| 1287 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext); | |
| 1288 } | |
| 1289 | |
| 1290 int token_offset = Context::kHeaderSize + | |
| 1291 Context::SECURITY_TOKEN_INDEX * kPointerSize; | |
| 1292 mov(scratch1, FieldOperand(scratch1, token_offset)); | |
| 1293 cmp(scratch1, FieldOperand(scratch2, token_offset)); | |
| 1294 j(not_equal, miss); | |
| 1295 | |
| 1296 bind(&same_contexts); | |
| 1297 } | |
| 1298 | |
| 1299 | |
| 1300 // Compute the hash code from the untagged key. This must be kept in sync with | 1227 // Compute the hash code from the untagged key. This must be kept in sync with |
| 1301 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in | 1228 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in |
| 1302 // code-stub-hydrogen.cc | 1229 // code-stub-hydrogen.cc |
| 1303 // | 1230 // |
| 1304 // Note: r0 will contain hash code | 1231 // Note: r0 will contain hash code |
| 1305 void MacroAssembler::GetNumberHash(Register r0, Register scratch) { | 1232 void MacroAssembler::GetNumberHash(Register r0, Register scratch) { |
| 1306 // Xor original key with a seed. | 1233 // Xor original key with a seed. |
| 1307 if (serializer_enabled()) { | 1234 if (serializer_enabled()) { |
| 1308 ExternalReference roots_array_start = | 1235 ExternalReference roots_array_start = |
| 1309 ExternalReference::roots_array_start(isolate()); | 1236 ExternalReference::roots_array_start(isolate()); |
| (...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3132 mov(eax, dividend); | 3059 mov(eax, dividend); |
| 3133 shr(eax, 31); | 3060 shr(eax, 31); |
| 3134 add(edx, eax); | 3061 add(edx, eax); |
| 3135 } | 3062 } |
| 3136 | 3063 |
| 3137 | 3064 |
| 3138 } // namespace internal | 3065 } // namespace internal |
| 3139 } // namespace v8 | 3066 } // namespace v8 |
| 3140 | 3067 |
| 3141 #endif // V8_TARGET_ARCH_X87 | 3068 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |