| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 254 } |
| 255 | 255 |
| 256 // Modifies the register even if it does not contain a Smi! | 256 // Modifies the register even if it does not contain a Smi! |
| 257 void SmiUntag(Register reg, Label* is_smi) { | 257 void SmiUntag(Register reg, Label* is_smi) { |
| 258 ASSERT(kSmiTagSize == 1); | 258 ASSERT(kSmiTagSize == 1); |
| 259 sar(reg, kSmiTagSize); | 259 sar(reg, kSmiTagSize); |
| 260 ASSERT(kSmiTag == 0); | 260 ASSERT(kSmiTag == 0); |
| 261 j(not_carry, is_smi); | 261 j(not_carry, is_smi); |
| 262 } | 262 } |
| 263 | 263 |
| 264 // Jump the register contains a smi. |
| 265 inline void JumpIfSmi(Register value, Label* smi_label) { |
| 266 test(value, Immediate(kSmiTagMask)); |
| 267 j(zero, smi_label, not_taken); |
| 268 } |
| 269 // Jump if register contain a non-smi. |
| 270 inline void JumpIfNotSmi(Register value, Label* not_smi_label) { |
| 271 test(value, Immediate(kSmiTagMask)); |
| 272 j(not_zero, not_smi_label, not_taken); |
| 273 } |
| 274 |
| 264 // Assumes input is a heap object. | 275 // Assumes input is a heap object. |
| 265 void JumpIfNotNumber(Register reg, TypeInfo info, Label* on_not_number); | 276 void JumpIfNotNumber(Register reg, TypeInfo info, Label* on_not_number); |
| 266 | 277 |
| 267 // Assumes input is a heap number. Jumps on things out of range. Also jumps | 278 // Assumes input is a heap number. Jumps on things out of range. Also jumps |
| 268 // on the min negative int32. Ignores frational parts. | 279 // on the min negative int32. Ignores frational parts. |
| 269 void ConvertToInt32(Register dst, | 280 void ConvertToInt32(Register dst, |
| 270 Register src, // Can be the same as dst. | 281 Register src, // Can be the same as dst. |
| 271 Register scratch, // Can be no_reg or dst, but not src. | 282 Register scratch, // Can be no_reg or dst, but not src. |
| 272 TypeInfo info, | 283 TypeInfo info, |
| 273 Label* on_not_int32); | 284 Label* on_not_int32); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 289 // --------------------------------------------------------------------------- | 300 // --------------------------------------------------------------------------- |
| 290 // Exception handling | 301 // Exception handling |
| 291 | 302 |
| 292 // Push a new try handler and link into try handler chain. The return | 303 // Push a new try handler and link into try handler chain. The return |
| 293 // address must be pushed before calling this helper. | 304 // address must be pushed before calling this helper. |
| 294 void PushTryHandler(CodeLocation try_location, HandlerType type); | 305 void PushTryHandler(CodeLocation try_location, HandlerType type); |
| 295 | 306 |
| 296 // Unlink the stack handler on top of the stack from the try handler chain. | 307 // Unlink the stack handler on top of the stack from the try handler chain. |
| 297 void PopTryHandler(); | 308 void PopTryHandler(); |
| 298 | 309 |
| 310 // Activate the top handler in the try hander chain. |
| 311 void Throw(Register value); |
| 312 |
| 313 void ThrowUncatchable(UncatchableExceptionType type, Register value); |
| 314 |
| 299 // --------------------------------------------------------------------------- | 315 // --------------------------------------------------------------------------- |
| 300 // Inline caching support | 316 // Inline caching support |
| 301 | 317 |
| 302 // Generate code for checking access rights - used for security checks | 318 // Generate code for checking access rights - used for security checks |
| 303 // on access to global objects across environments. The holder register | 319 // on access to global objects across environments. The holder register |
| 304 // is left untouched, but the scratch register is clobbered. | 320 // is left untouched, but the scratch register is clobbered. |
| 305 void CheckAccessGlobalProxy(Register holder_reg, | 321 void CheckAccessGlobalProxy(Register holder_reg, |
| 306 Register scratch, | 322 Register scratch, |
| 307 Label* miss); | 323 Label* miss); |
| 308 | 324 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 // initialized. | 398 // initialized. |
| 383 void AllocateConsString(Register result, | 399 void AllocateConsString(Register result, |
| 384 Register scratch1, | 400 Register scratch1, |
| 385 Register scratch2, | 401 Register scratch2, |
| 386 Label* gc_required); | 402 Label* gc_required); |
| 387 void AllocateAsciiConsString(Register result, | 403 void AllocateAsciiConsString(Register result, |
| 388 Register scratch1, | 404 Register scratch1, |
| 389 Register scratch2, | 405 Register scratch2, |
| 390 Label* gc_required); | 406 Label* gc_required); |
| 391 | 407 |
| 392 // All registers must be distinct. Only current_string needs valid contents | 408 // Copy memory, byte-by-byte, from source to destination. Not optimized for |
| 393 // on entry. All registers may be invalid on exit. result_operand is | 409 // long or aligned copies. |
| 394 // unchanged, padding_chars is updated correctly. | 410 // The contents of index and scratch are destroyed. |
| 395 // The top of new space must contain a sequential ascii string with | 411 void CopyBytes(Register source, |
| 396 // padding_chars bytes free in its top word. The sequential ascii string | 412 Register destination, |
| 397 // current_string is concatenated to it, allocating the necessary amount | 413 Register length, |
| 398 // of new memory. | 414 Register scratch); |
| 399 void AppendStringToTopOfNewSpace( | |
| 400 Register current_string, // Tagged pointer to string to copy. | |
| 401 Register current_string_length, | |
| 402 Register result_pos, | |
| 403 Register scratch, | |
| 404 Register new_padding_chars, | |
| 405 Operand operand_result, | |
| 406 Operand operand_padding_chars, | |
| 407 Label* bailout); | |
| 408 | 415 |
| 409 // --------------------------------------------------------------------------- | 416 // --------------------------------------------------------------------------- |
| 410 // Support functions. | 417 // Support functions. |
| 411 | 418 |
| 412 // Check if result is zero and op is negative. | 419 // Check if result is zero and op is negative. |
| 413 void NegativeZeroTest(Register result, Register op, Label* then_label); | 420 void NegativeZeroTest(Register result, Register op, Label* then_label); |
| 414 | 421 |
| 415 // Check if result is zero and op is negative in code using jump targets. | 422 // Check if result is zero and op is negative in code using jump targets. |
| 416 void NegativeZeroTest(CodeGenerator* cgen, | 423 void NegativeZeroTest(CodeGenerator* cgen, |
| 417 Register result, | 424 Register result, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 void JumpToExternalReference(const ExternalReference& ext); | 551 void JumpToExternalReference(const ExternalReference& ext); |
| 545 | 552 |
| 546 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext); | 553 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext); |
| 547 | 554 |
| 548 | 555 |
| 549 // --------------------------------------------------------------------------- | 556 // --------------------------------------------------------------------------- |
| 550 // Utilities | 557 // Utilities |
| 551 | 558 |
| 552 void Ret(); | 559 void Ret(); |
| 553 | 560 |
| 561 // Return and drop arguments from stack, where the number of arguments |
| 562 // may be bigger than 2^16 - 1. Requires a scratch register. |
| 563 void Ret(int bytes_dropped, Register scratch); |
| 564 |
| 554 // Emit code to discard a non-negative number of pointer-sized elements | 565 // Emit code to discard a non-negative number of pointer-sized elements |
| 555 // from the stack, clobbering only the esp register. | 566 // from the stack, clobbering only the esp register. |
| 556 void Drop(int element_count); | 567 void Drop(int element_count); |
| 557 | 568 |
| 558 void Call(Label* target) { call(target); } | 569 void Call(Label* target) { call(target); } |
| 559 | 570 |
| 560 // Emit call to the code we are currently generating. | 571 // Emit call to the code we are currently generating. |
| 561 void CallSelf() { | 572 void CallSelf() { |
| 562 Handle<Code> self(reinterpret_cast<Code**>(CodeObject().location())); | 573 Handle<Code> self(reinterpret_cast<Code**>(CodeObject().location())); |
| 563 call(self, RelocInfo::CODE_TARGET); | 574 call(self, RelocInfo::CODE_TARGET); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 } \ | 779 } \ |
| 769 masm-> | 780 masm-> |
| 770 #else | 781 #else |
| 771 #define ACCESS_MASM(masm) masm-> | 782 #define ACCESS_MASM(masm) masm-> |
| 772 #endif | 783 #endif |
| 773 | 784 |
| 774 | 785 |
| 775 } } // namespace v8::internal | 786 } } // namespace v8::internal |
| 776 | 787 |
| 777 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 788 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| OLD | NEW |