OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 ExternalReference passed_function = | 118 ExternalReference passed_function = |
119 ExternalReference::builtin_passed_function(); | 119 ExternalReference::builtin_passed_function(); |
120 CHECK_EQ(make_code(UNCLASSIFIED, 1), | 120 CHECK_EQ(make_code(UNCLASSIFIED, 1), |
121 encoder.Encode(passed_function.address())); | 121 encoder.Encode(passed_function.address())); |
122 ExternalReference the_hole_value_location = | 122 ExternalReference the_hole_value_location = |
123 ExternalReference::the_hole_value_location(); | 123 ExternalReference::the_hole_value_location(); |
124 CHECK_EQ(make_code(UNCLASSIFIED, 2), | 124 CHECK_EQ(make_code(UNCLASSIFIED, 2), |
125 encoder.Encode(the_hole_value_location.address())); | 125 encoder.Encode(the_hole_value_location.address())); |
126 ExternalReference stack_guard_limit_address = | 126 ExternalReference stack_guard_limit_address = |
127 ExternalReference::address_of_stack_guard_limit(); | 127 ExternalReference::address_of_stack_guard_limit(); |
128 CHECK_EQ(make_code(UNCLASSIFIED, 3), | 128 CHECK_EQ(make_code(UNCLASSIFIED, 4), |
129 encoder.Encode(stack_guard_limit_address.address())); | 129 encoder.Encode(stack_guard_limit_address.address())); |
130 CHECK_EQ(make_code(UNCLASSIFIED, 5), | 130 CHECK_EQ(make_code(UNCLASSIFIED, 10), |
131 encoder.Encode(ExternalReference::debug_break().address())); | 131 encoder.Encode(ExternalReference::debug_break().address())); |
132 CHECK_EQ(make_code(UNCLASSIFIED, 6), | 132 CHECK_EQ(make_code(UNCLASSIFIED, 6), |
133 encoder.Encode(ExternalReference::new_space_start().address())); | 133 encoder.Encode(ExternalReference::new_space_start().address())); |
134 } | 134 } |
135 | 135 |
136 | 136 |
137 TEST(ExternalReferenceDecoder) { | 137 TEST(ExternalReferenceDecoder) { |
138 StatsTable::SetCounterFunction(counter_function); | 138 StatsTable::SetCounterFunction(counter_function); |
139 Heap::Setup(false); | 139 Heap::Setup(false); |
140 ExternalReferenceDecoder decoder; | 140 ExternalReferenceDecoder decoder; |
141 CHECK_EQ(AddressOf(Builtins::ArrayCode), | 141 CHECK_EQ(AddressOf(Builtins::ArrayCode), |
142 decoder.Decode(make_code(BUILTIN, Builtins::ArrayCode))); | 142 decoder.Decode(make_code(BUILTIN, Builtins::ArrayCode))); |
143 CHECK_EQ(AddressOf(Runtime::kAbort), | 143 CHECK_EQ(AddressOf(Runtime::kAbort), |
144 decoder.Decode(make_code(RUNTIME_FUNCTION, Runtime::kAbort))); | 144 decoder.Decode(make_code(RUNTIME_FUNCTION, Runtime::kAbort))); |
145 CHECK_EQ(AddressOf(IC_Utility(IC::kLoadCallbackProperty)), | 145 CHECK_EQ(AddressOf(IC_Utility(IC::kLoadCallbackProperty)), |
146 decoder.Decode(make_code(IC_UTILITY, IC::kLoadCallbackProperty))); | 146 decoder.Decode(make_code(IC_UTILITY, IC::kLoadCallbackProperty))); |
147 CHECK_EQ(AddressOf(Debug_Address(Debug::k_register_address, 3)), | 147 CHECK_EQ(AddressOf(Debug_Address(Debug::k_register_address, 3)), |
148 decoder.Decode(make_code(DEBUG_ADDRESS, register_code(3)))); | 148 decoder.Decode(make_code(DEBUG_ADDRESS, register_code(3)))); |
149 ExternalReference keyed_load_function = | 149 ExternalReference keyed_load_function = |
150 ExternalReference(&Counters::keyed_load_function_prototype); | 150 ExternalReference(&Counters::keyed_load_function_prototype); |
151 CHECK_EQ(keyed_load_function.address(), | 151 CHECK_EQ(keyed_load_function.address(), |
152 decoder.Decode( | 152 decoder.Decode( |
153 make_code(STATS_COUNTER, | 153 make_code(STATS_COUNTER, |
154 Counters::k_keyed_load_function_prototype))); | 154 Counters::k_keyed_load_function_prototype))); |
155 CHECK_EQ(ExternalReference::builtin_passed_function().address(), | 155 CHECK_EQ(ExternalReference::builtin_passed_function().address(), |
156 decoder.Decode(make_code(UNCLASSIFIED, 1))); | 156 decoder.Decode(make_code(UNCLASSIFIED, 1))); |
157 CHECK_EQ(ExternalReference::the_hole_value_location().address(), | 157 CHECK_EQ(ExternalReference::the_hole_value_location().address(), |
158 decoder.Decode(make_code(UNCLASSIFIED, 2))); | 158 decoder.Decode(make_code(UNCLASSIFIED, 2))); |
159 CHECK_EQ(ExternalReference::address_of_stack_guard_limit().address(), | 159 CHECK_EQ(ExternalReference::address_of_stack_guard_limit().address(), |
160 decoder.Decode(make_code(UNCLASSIFIED, 3))); | 160 decoder.Decode(make_code(UNCLASSIFIED, 4))); |
161 CHECK_EQ(ExternalReference::debug_break().address(), | 161 CHECK_EQ(ExternalReference::debug_break().address(), |
162 decoder.Decode(make_code(UNCLASSIFIED, 5))); | 162 decoder.Decode(make_code(UNCLASSIFIED, 10))); |
163 CHECK_EQ(ExternalReference::new_space_start().address(), | 163 CHECK_EQ(ExternalReference::new_space_start().address(), |
164 decoder.Decode(make_code(UNCLASSIFIED, 6))); | 164 decoder.Decode(make_code(UNCLASSIFIED, 6))); |
165 } | 165 } |
166 | 166 |
167 | 167 |
168 static void Serialize() { | 168 static void Serialize() { |
169 #ifdef DEBUG | 169 #ifdef DEBUG |
170 FLAG_debug_serialization = true; | 170 FLAG_debug_serialization = true; |
171 #endif | 171 #endif |
172 StatsTable::SetCounterFunction(counter_function); | 172 StatsTable::SetCounterFunction(counter_function); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 DEPENDENT_TEST(DeserializeExtensions, Serialize) { | 277 DEPENDENT_TEST(DeserializeExtensions, Serialize) { |
278 v8::HandleScope scope; | 278 v8::HandleScope scope; |
279 | 279 |
280 Deserialize(); | 280 Deserialize(); |
281 const char* c_source = "gc();"; | 281 const char* c_source = "gc();"; |
282 v8::Local<v8::String> source = v8::String::New(c_source); | 282 v8::Local<v8::String> source = v8::String::New(c_source); |
283 v8::Local<v8::Script> script = v8::Script::Compile(source); | 283 v8::Local<v8::Script> script = v8::Script::Compile(source); |
284 v8::Local<v8::Value> value = script->Run(); | 284 v8::Local<v8::Value> value = script->Run(); |
285 CHECK(value->IsUndefined()); | 285 CHECK(value->IsUndefined()); |
286 } | 286 } |
OLD | NEW |