OLD | NEW |
---|---|
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 18 matching lines...) Expand all Loading... | |
29 | 29 |
30 | 30 |
31 #include "v8.h" | 31 #include "v8.h" |
32 #include "ast.h" | 32 #include "ast.h" |
33 #include "bytecodes-irregexp.h" | 33 #include "bytecodes-irregexp.h" |
34 | 34 |
35 | 35 |
36 namespace v8 { namespace internal { | 36 namespace v8 { namespace internal { |
37 | 37 |
38 | 38 |
39 void RegExpMacroAssemblerIrregexp::Emit(uint32_t byte) { | 39 void RegExpMacroAssemblerIrregexp::Emit(uint32_t byte, uint32_t twenty_four_bits ) { |
Christian Plesner Hansen
2009/01/20 14:22:17
Maybe assert that twenty_four_bits does indeed onl
Erik Corry
2009/01/20 18:49:55
Right now we don't check so the assert would not a
| |
40 uint32_t word = ((twenty_four_bits << BYTECODE_SHIFT) | byte); | |
40 ASSERT(pc_ <= buffer_.length()); | 41 ASSERT(pc_ <= buffer_.length()); |
41 if (pc_ == buffer_.length()) { | 42 if (pc_ + 3 >= buffer_.length()) { |
42 Expand(); | 43 Expand(); |
43 } | 44 } |
44 buffer_[pc_++] = byte; | 45 Store32(buffer_.start() + pc_, word); |
46 pc_ += 4; | |
45 } | 47 } |
46 | 48 |
47 | 49 |
48 void RegExpMacroAssemblerIrregexp::Emit16(uint32_t word) { | 50 void RegExpMacroAssemblerIrregexp::Emit16(uint32_t word) { |
49 ASSERT(pc_ <= buffer_.length()); | 51 ASSERT(pc_ <= buffer_.length()); |
50 if (pc_ + 1 >= buffer_.length()) { | 52 if (pc_ + 1 >= buffer_.length()) { |
51 Expand(); | 53 Expand(); |
52 } | 54 } |
53 Store16(buffer_.start() + pc_, word); | 55 Store16(buffer_.start() + pc_, word); |
54 pc_ += 2; | 56 pc_ += 2; |
55 } | 57 } |
56 | 58 |
57 | 59 |
58 void RegExpMacroAssemblerIrregexp::Emit32(uint32_t word) { | 60 void RegExpMacroAssemblerIrregexp::Emit32(uint32_t word) { |
59 ASSERT(pc_ <= buffer_.length()); | 61 ASSERT(pc_ <= buffer_.length()); |
60 if (pc_ + 3 >= buffer_.length()) { | 62 if (pc_ + 3 >= buffer_.length()) { |
61 Expand(); | 63 Expand(); |
62 } | 64 } |
63 Store32(buffer_.start() + pc_, word); | 65 Store32(buffer_.start() + pc_, word); |
64 pc_ += 4; | 66 pc_ += 4; |
65 } | 67 } |
66 | 68 |
67 | 69 |
68 } } // namespace v8::internal | 70 } } // namespace v8::internal |
OLD | NEW |