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 3940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3951 __ movq(rbp_as_smi.reg(), rbp); | 3951 __ movq(rbp_as_smi.reg(), rbp); |
3952 frame_->Push(&rbp_as_smi); | 3952 frame_->Push(&rbp_as_smi); |
3953 } | 3953 } |
3954 | 3954 |
3955 | 3955 |
3956 void CodeGenerator::GenerateRandomPositiveSmi(ZoneList<Expression*>* args) { | 3956 void CodeGenerator::GenerateRandomPositiveSmi(ZoneList<Expression*>* args) { |
3957 ASSERT(args->length() == 0); | 3957 ASSERT(args->length() == 0); |
3958 frame_->SpillAll(); | 3958 frame_->SpillAll(); |
3959 __ push(rsi); | 3959 __ push(rsi); |
3960 | 3960 |
3961 // Make sure the frame is aligned like the OS expects. | 3961 int num_arguments = 0; |
Søren Thygesen Gjesse
2010/02/25 12:29:21
Please change this to static const.
| |
3962 static const int kFrameAlignment = OS::ActivationFrameAlignment(); | 3962 __ PrepareCallCFunction(num_arguments); |
3963 if (kFrameAlignment > 0) { | |
3964 ASSERT(IsPowerOf2(kFrameAlignment)); | |
3965 __ movq(rbx, rsp); // Save in AMD-64 abi callee-saved register. | |
3966 __ and_(rsp, Immediate(-kFrameAlignment)); | |
3967 } | |
3968 | 3963 |
3969 // Call V8::RandomPositiveSmi(). | 3964 // Call V8::RandomPositiveSmi(). |
3970 __ Call(FUNCTION_ADDR(V8::RandomPositiveSmi), RelocInfo::RUNTIME_ENTRY); | 3965 __ CallCFunction(ExternalReference::random_positive_smi_function(), |
3971 | 3966 num_arguments); |
3972 // Restore stack pointer from callee-saved register. | |
3973 if (kFrameAlignment > 0) { | |
3974 __ movq(rsp, rbx); | |
3975 } | |
3976 | 3967 |
3977 __ pop(rsi); | 3968 __ pop(rsi); |
3978 Result result = allocator_->Allocate(rax); | 3969 Result result = allocator_->Allocate(rax); |
3979 frame_->Push(&result); | 3970 frame_->Push(&result); |
3980 } | 3971 } |
3981 | 3972 |
3982 | 3973 |
3983 void CodeGenerator::GenerateRegExpExec(ZoneList<Expression*>* args) { | 3974 void CodeGenerator::GenerateRegExpExec(ZoneList<Expression*>* args) { |
3984 ASSERT_EQ(args->length(), 4); | 3975 ASSERT_EQ(args->length(), 4); |
3985 | 3976 |
(...skipping 5525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9511 // Call the function from C++. | 9502 // Call the function from C++. |
9512 return FUNCTION_CAST<ModuloFunction>(buffer); | 9503 return FUNCTION_CAST<ModuloFunction>(buffer); |
9513 } | 9504 } |
9514 | 9505 |
9515 #endif | 9506 #endif |
9516 | 9507 |
9517 | 9508 |
9518 #undef __ | 9509 #undef __ |
9519 | 9510 |
9520 } } // namespace v8::internal | 9511 } } // namespace v8::internal |
OLD | NEW |