Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: test/cctest/test-serialize.cc

Issue 17376: Avoiding the assumption that the pc pointer of RelocInfo points to the word c... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/serialize.cc ('K') | « src/serialize.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 CHECK_EQ(make_code(UNCLASSIFIED, 1), 102 CHECK_EQ(make_code(UNCLASSIFIED, 1),
103 encoder.Encode(passed_function.address())); 103 encoder.Encode(passed_function.address()));
104 ExternalReference the_hole_value_location = 104 ExternalReference the_hole_value_location =
105 ExternalReference::the_hole_value_location(); 105 ExternalReference::the_hole_value_location();
106 CHECK_EQ(make_code(UNCLASSIFIED, 2), 106 CHECK_EQ(make_code(UNCLASSIFIED, 2),
107 encoder.Encode(the_hole_value_location.address())); 107 encoder.Encode(the_hole_value_location.address()));
108 ExternalReference stack_guard_limit_address = 108 ExternalReference stack_guard_limit_address =
109 ExternalReference::address_of_stack_guard_limit(); 109 ExternalReference::address_of_stack_guard_limit();
110 CHECK_EQ(make_code(UNCLASSIFIED, 3), 110 CHECK_EQ(make_code(UNCLASSIFIED, 3),
111 encoder.Encode(stack_guard_limit_address.address())); 111 encoder.Encode(stack_guard_limit_address.address()));
112 CHECK_EQ(make_code(UNCLASSIFIED, 4), 112 CHECK_EQ(make_code(UNCLASSIFIED, 5),
Mads Ager (chromium) 2009/01/13 14:26:10 Do you want to have a test for index 4 here as wel
olehougaard 2009/01/13 14:35:22 Not really. A few samples should be sufficient or
113 encoder.Encode(ExternalReference::debug_break().address())); 113 encoder.Encode(ExternalReference::debug_break().address()));
114 CHECK_EQ(make_code(UNCLASSIFIED, 5), 114 CHECK_EQ(make_code(UNCLASSIFIED, 6),
115 encoder.Encode(ExternalReference::new_space_start().address())); 115 encoder.Encode(ExternalReference::new_space_start().address()));
116 } 116 }
117 117
118 118
119 TEST(ExternalReferenceDecoder) { 119 TEST(ExternalReferenceDecoder) {
120 StatsTable::SetCounterFunction(counter_function); 120 StatsTable::SetCounterFunction(counter_function);
121 Heap::Setup(false); 121 Heap::Setup(false);
122 ExternalReferenceDecoder decoder; 122 ExternalReferenceDecoder decoder;
123 CHECK_EQ(AddressOf(Builtins::ArrayCode), 123 CHECK_EQ(AddressOf(Builtins::ArrayCode),
124 decoder.Decode(make_code(BUILTIN, Builtins::ArrayCode))); 124 decoder.Decode(make_code(BUILTIN, Builtins::ArrayCode)));
125 CHECK_EQ(AddressOf(Runtime::kAbort), 125 CHECK_EQ(AddressOf(Runtime::kAbort),
126 decoder.Decode(make_code(RUNTIME_FUNCTION, Runtime::kAbort))); 126 decoder.Decode(make_code(RUNTIME_FUNCTION, Runtime::kAbort)));
127 CHECK_EQ(AddressOf(IC_Utility(IC::kLoadCallbackProperty)), 127 CHECK_EQ(AddressOf(IC_Utility(IC::kLoadCallbackProperty)),
128 decoder.Decode(make_code(IC_UTILITY, IC::kLoadCallbackProperty))); 128 decoder.Decode(make_code(IC_UTILITY, IC::kLoadCallbackProperty)));
129 CHECK_EQ(AddressOf(Debug_Address(Debug::k_register_address, 3)), 129 CHECK_EQ(AddressOf(Debug_Address(Debug::k_register_address, 3)),
130 decoder.Decode(make_code(DEBUG_ADDRESS, register_code(3)))); 130 decoder.Decode(make_code(DEBUG_ADDRESS, register_code(3))));
131 ExternalReference keyed_load_function = 131 ExternalReference keyed_load_function =
132 ExternalReference(&Counters::keyed_load_function_prototype); 132 ExternalReference(&Counters::keyed_load_function_prototype);
133 CHECK_EQ(keyed_load_function.address(), 133 CHECK_EQ(keyed_load_function.address(),
134 decoder.Decode( 134 decoder.Decode(
135 make_code(STATS_COUNTER, 135 make_code(STATS_COUNTER,
136 Counters::k_keyed_load_function_prototype))); 136 Counters::k_keyed_load_function_prototype)));
137 CHECK_EQ(ExternalReference::builtin_passed_function().address(), 137 CHECK_EQ(ExternalReference::builtin_passed_function().address(),
138 decoder.Decode(make_code(UNCLASSIFIED, 1))); 138 decoder.Decode(make_code(UNCLASSIFIED, 1)));
139 CHECK_EQ(ExternalReference::the_hole_value_location().address(), 139 CHECK_EQ(ExternalReference::the_hole_value_location().address(),
140 decoder.Decode(make_code(UNCLASSIFIED, 2))); 140 decoder.Decode(make_code(UNCLASSIFIED, 2)));
141 CHECK_EQ(ExternalReference::address_of_stack_guard_limit().address(), 141 CHECK_EQ(ExternalReference::address_of_stack_guard_limit().address(),
142 decoder.Decode(make_code(UNCLASSIFIED, 3))); 142 decoder.Decode(make_code(UNCLASSIFIED, 3)));
143 CHECK_EQ(ExternalReference::debug_break().address(), 143 CHECK_EQ(ExternalReference::debug_break().address(),
144 decoder.Decode(make_code(UNCLASSIFIED, 4))); 144 decoder.Decode(make_code(UNCLASSIFIED, 5)));
Mads Ager (chromium) 2009/01/13 14:26:10 Ditto.
olehougaard 2009/01/13 14:35:22 Ditto :)
145 CHECK_EQ(ExternalReference::new_space_start().address(), 145 CHECK_EQ(ExternalReference::new_space_start().address(),
146 decoder.Decode(make_code(UNCLASSIFIED, 5))); 146 decoder.Decode(make_code(UNCLASSIFIED, 6)));
147 } 147 }
148 148
149 149
150 static void Serialize() { 150 static void Serialize() {
151 #ifdef DEBUG 151 #ifdef DEBUG
152 FLAG_debug_serialization = true; 152 FLAG_debug_serialization = true;
153 #endif 153 #endif
154 StatsTable::SetCounterFunction(counter_function); 154 StatsTable::SetCounterFunction(counter_function);
155 155
156 v8::HandleScope scope; 156 v8::HandleScope scope;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 TEST(DeserializeExtensions) { 257 TEST(DeserializeExtensions) {
258 v8::HandleScope scope; 258 v8::HandleScope scope;
259 259
260 Deserialize(); 260 Deserialize();
261 const char* c_source = "gc();"; 261 const char* c_source = "gc();";
262 v8::Local<v8::String> source = v8::String::New(c_source); 262 v8::Local<v8::String> source = v8::String::New(c_source);
263 v8::Local<v8::Script> script = v8::Script::Compile(source); 263 v8::Local<v8::Script> script = v8::Script::Compile(source);
264 v8::Local<v8::Value> value = script->Run(); 264 v8::Local<v8::Value> value = script->Run();
265 CHECK(value->IsUndefined()); 265 CHECK(value->IsUndefined());
266 } 266 }
OLDNEW
« src/serialize.cc ('K') | « src/serialize.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698