| 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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1353 | 1353 |
| 1354 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { | 1354 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { |
| 1355 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); | 1355 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
| 1356 } | 1356 } |
| 1357 | 1357 |
| 1358 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { | 1358 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { |
| 1359 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); | 1359 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
| 1360 } | 1360 } |
| 1361 | 1361 |
| 1362 // static | 1362 // static |
| 1363 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | |
| 1364 int field_index) { | |
| 1365 // ----------- S t a t e ------------- | |
| 1366 // -- eax : number of arguments | |
| 1367 // -- edi : function | |
| 1368 // -- esi : context | |
| 1369 // -- esp[0] : return address | |
| 1370 // -- esp[4] : receiver | |
| 1371 // ----------------------------------- | |
| 1372 | |
| 1373 // 1. Load receiver into eax and check that it's actually a JSDate object. | |
| 1374 Label receiver_not_date; | |
| 1375 { | |
| 1376 __ mov(eax, Operand(esp, kPointerSize)); | |
| 1377 __ JumpIfSmi(eax, &receiver_not_date); | |
| 1378 __ CmpObjectType(eax, JS_DATE_TYPE, ebx); | |
| 1379 __ j(not_equal, &receiver_not_date); | |
| 1380 } | |
| 1381 | |
| 1382 // 2. Load the specified date field, falling back to the runtime as necessary. | |
| 1383 if (field_index == JSDate::kDateValue) { | |
| 1384 __ mov(eax, FieldOperand(eax, JSDate::kValueOffset)); | |
| 1385 } else { | |
| 1386 if (field_index < JSDate::kFirstUncachedField) { | |
| 1387 Label stamp_mismatch; | |
| 1388 __ mov(edx, Operand::StaticVariable( | |
| 1389 ExternalReference::date_cache_stamp(masm->isolate()))); | |
| 1390 __ cmp(edx, FieldOperand(eax, JSDate::kCacheStampOffset)); | |
| 1391 __ j(not_equal, &stamp_mismatch, Label::kNear); | |
| 1392 __ mov(eax, FieldOperand( | |
| 1393 eax, JSDate::kValueOffset + field_index * kPointerSize)); | |
| 1394 __ ret(1 * kPointerSize); | |
| 1395 __ bind(&stamp_mismatch); | |
| 1396 } | |
| 1397 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 1398 __ PrepareCallCFunction(2, ebx); | |
| 1399 __ mov(Operand(esp, 0), eax); | |
| 1400 __ mov(Operand(esp, 1 * kPointerSize), | |
| 1401 Immediate(Smi::FromInt(field_index))); | |
| 1402 __ CallCFunction( | |
| 1403 ExternalReference::get_date_field_function(masm->isolate()), 2); | |
| 1404 } | |
| 1405 __ ret(1 * kPointerSize); | |
| 1406 | |
| 1407 // 3. Raise a TypeError if the receiver is not a date. | |
| 1408 __ bind(&receiver_not_date); | |
| 1409 { | |
| 1410 FrameScope scope(masm, StackFrame::MANUAL); | |
| 1411 __ Move(ebx, Immediate(0)); | |
| 1412 __ EnterBuiltinFrame(esi, edi, ebx); | |
| 1413 __ CallRuntime(Runtime::kThrowNotDateError); | |
| 1414 | |
| 1415 // It's far from obvious, but this final trailing instruction after the call | |
| 1416 // is required for StackFrame::LookupCode to work correctly. To illustrate | |
| 1417 // why: if call were the final instruction in the code object, then the pc | |
| 1418 // (== return address) would point beyond the code object when the stack is | |
| 1419 // traversed. When we then try to look up the code object through | |
| 1420 // StackFrame::LookupCode, we actually return the next code object that | |
| 1421 // happens to be on the same page in memory. | |
| 1422 // TODO(jgruber): A proper fix for this would be nice. | |
| 1423 __ nop(); | |
| 1424 } | |
| 1425 } | |
| 1426 | |
| 1427 // static | |
| 1428 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1363 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
| 1429 // ----------- S t a t e ------------- | 1364 // ----------- S t a t e ------------- |
| 1430 // -- eax : argc | 1365 // -- eax : argc |
| 1431 // -- esp[0] : return address | 1366 // -- esp[0] : return address |
| 1432 // -- esp[4] : argArray | 1367 // -- esp[4] : argArray |
| 1433 // -- esp[8] : thisArg | 1368 // -- esp[8] : thisArg |
| 1434 // -- esp[12] : receiver | 1369 // -- esp[12] : receiver |
| 1435 // ----------------------------------- | 1370 // ----------------------------------- |
| 1436 | 1371 |
| 1437 // 1. Load receiver into edi, argArray into eax (if present), remove all | 1372 // 1. Load receiver into edi, argArray into eax (if present), remove all |
| (...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3160 | 3095 |
| 3161 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3096 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 3162 Generate_OnStackReplacementHelper(masm, true); | 3097 Generate_OnStackReplacementHelper(masm, true); |
| 3163 } | 3098 } |
| 3164 | 3099 |
| 3165 #undef __ | 3100 #undef __ |
| 3166 } // namespace internal | 3101 } // namespace internal |
| 3167 } // namespace v8 | 3102 } // namespace v8 |
| 3168 | 3103 |
| 3169 #endif // V8_TARGET_ARCH_IA32 | 3104 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |