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

Side by Side Diff: src/code-stubs.cc

Issue 26680002: Ensure only whitelisted stubs have sse2 versions in the snapshot. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: string add is unsafe since it has a double saving centry stub Created 7 years, 2 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
« no previous file with comments | « src/code-stubs.h ('k') | src/ia32/assembler-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 GetICState(), 122 GetICState(),
123 GetExtraICState(), 123 GetExtraICState(),
124 GetStubType(), 124 GetStubType(),
125 GetStubFlags()); 125 GetStubFlags());
126 Handle<Code> new_object = factory->NewCode( 126 Handle<Code> new_object = factory->NewCode(
127 desc, flags, masm.CodeObject(), NeedsImmovableCode()); 127 desc, flags, masm.CodeObject(), NeedsImmovableCode());
128 return new_object; 128 return new_object;
129 } 129 }
130 130
131 131
132 void CodeStub::VerifyPlatformFeatures(Isolate* isolate) {
133 ASSERT(CpuFeatures::VerifyCrossCompiling());
134 }
135
136
132 Handle<Code> CodeStub::GetCode(Isolate* isolate) { 137 Handle<Code> CodeStub::GetCode(Isolate* isolate) {
133 Factory* factory = isolate->factory(); 138 Factory* factory = isolate->factory();
134 Heap* heap = isolate->heap(); 139 Heap* heap = isolate->heap();
135 Code* code; 140 Code* code;
136 if (UseSpecialCache() 141 if (UseSpecialCache()
137 ? FindCodeInSpecialCache(&code, isolate) 142 ? FindCodeInSpecialCache(&code, isolate)
138 : FindCodeInCache(&code, isolate)) { 143 : FindCodeInCache(&code, isolate)) {
139 ASSERT(IsPregenerated(isolate) == code->is_pregenerated()); 144 ASSERT(IsPregenerated(isolate) == code->is_pregenerated());
140 ASSERT(GetCodeKind() == code->kind()); 145 ASSERT(GetCodeKind() == code->kind());
141 return Handle<Code>(code); 146 return Handle<Code>(code);
142 } 147 }
143 148
149 #ifdef DEBUG
150 VerifyPlatformFeatures(isolate);
151 #endif
152
144 { 153 {
145 HandleScope scope(isolate); 154 HandleScope scope(isolate);
146 155
147 Handle<Code> new_object = GenerateCode(isolate); 156 Handle<Code> new_object = GenerateCode(isolate);
148 new_object->set_major_key(MajorKey()); 157 new_object->set_major_key(MajorKey());
149 FinishCode(new_object); 158 FinishCode(new_object);
150 RecordCodeGeneration(*new_object, isolate); 159 RecordCodeGeneration(*new_object, isolate);
151 160
152 #ifdef ENABLE_DISASSEMBLER 161 #ifdef ENABLE_DISASSEMBLER
153 if (FLAG_print_code_stubs) { 162 if (FLAG_print_code_stubs) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 for (unsigned i = 0; i < ARRAY_SIZE(binop); i++) { 299 for (unsigned i = 0; i < ARRAY_SIZE(binop); i++) {
291 BinaryOpStub stub(UNINITIALIZED); 300 BinaryOpStub stub(UNINITIALIZED);
292 stub.op_ = binop[i]; 301 stub.op_ = binop[i];
293 stub.GetCode(isolate); 302 stub.GetCode(isolate);
294 } 303 }
295 304
296 // TODO(olivf) We should investigate why adding stubs to the snapshot is so 305 // TODO(olivf) We should investigate why adding stubs to the snapshot is so
297 // expensive at runtime. When solved we should be able to add most binops to 306 // expensive at runtime. When solved we should be able to add most binops to
298 // the snapshot instead of hand-picking them. 307 // the snapshot instead of hand-picking them.
299 // Generated list of commonly used stubs 308 // Generated list of commonly used stubs
300 Generate(Token::ADD, GENERIC, STRING, STRING, NO_OVERWRITE, isolate);
301 Generate(Token::ADD, GENERIC, STRING, STRING, OVERWRITE_RIGHT, isolate);
302 Generate(Token::ADD, INT32, INT32, INT32, NO_OVERWRITE, isolate); 309 Generate(Token::ADD, INT32, INT32, INT32, NO_OVERWRITE, isolate);
303 Generate(Token::ADD, INT32, INT32, INT32, OVERWRITE_LEFT, isolate); 310 Generate(Token::ADD, INT32, INT32, INT32, OVERWRITE_LEFT, isolate);
304 Generate(Token::ADD, INT32, INT32, NUMBER, NO_OVERWRITE, isolate); 311 Generate(Token::ADD, INT32, INT32, NUMBER, NO_OVERWRITE, isolate);
305 Generate(Token::ADD, INT32, INT32, NUMBER, OVERWRITE_LEFT, isolate); 312 Generate(Token::ADD, INT32, INT32, NUMBER, OVERWRITE_LEFT, isolate);
306 Generate(Token::ADD, INT32, NUMBER, NUMBER, NO_OVERWRITE, isolate); 313 Generate(Token::ADD, INT32, NUMBER, NUMBER, NO_OVERWRITE, isolate);
307 Generate(Token::ADD, INT32, NUMBER, NUMBER, OVERWRITE_LEFT, isolate); 314 Generate(Token::ADD, INT32, NUMBER, NUMBER, OVERWRITE_LEFT, isolate);
308 Generate(Token::ADD, INT32, NUMBER, NUMBER, OVERWRITE_RIGHT, isolate); 315 Generate(Token::ADD, INT32, NUMBER, NUMBER, OVERWRITE_RIGHT, isolate);
309 Generate(Token::ADD, INT32, SMI, INT32, NO_OVERWRITE, isolate); 316 Generate(Token::ADD, INT32, SMI, INT32, NO_OVERWRITE, isolate);
310 Generate(Token::ADD, INT32, SMI, INT32, OVERWRITE_LEFT, isolate); 317 Generate(Token::ADD, INT32, SMI, INT32, OVERWRITE_LEFT, isolate);
311 Generate(Token::ADD, INT32, SMI, INT32, OVERWRITE_RIGHT, isolate); 318 Generate(Token::ADD, INT32, SMI, INT32, OVERWRITE_RIGHT, isolate);
312 Generate(Token::ADD, NUMBER, INT32, NUMBER, NO_OVERWRITE, isolate); 319 Generate(Token::ADD, NUMBER, INT32, NUMBER, NO_OVERWRITE, isolate);
313 Generate(Token::ADD, NUMBER, INT32, NUMBER, OVERWRITE_LEFT, isolate); 320 Generate(Token::ADD, NUMBER, INT32, NUMBER, OVERWRITE_LEFT, isolate);
314 Generate(Token::ADD, NUMBER, INT32, NUMBER, OVERWRITE_RIGHT, isolate); 321 Generate(Token::ADD, NUMBER, INT32, NUMBER, OVERWRITE_RIGHT, isolate);
315 Generate(Token::ADD, NUMBER, NUMBER, NUMBER, NO_OVERWRITE, isolate); 322 Generate(Token::ADD, NUMBER, NUMBER, NUMBER, NO_OVERWRITE, isolate);
316 Generate(Token::ADD, NUMBER, NUMBER, NUMBER, OVERWRITE_LEFT, isolate); 323 Generate(Token::ADD, NUMBER, NUMBER, NUMBER, OVERWRITE_LEFT, isolate);
317 Generate(Token::ADD, NUMBER, NUMBER, NUMBER, OVERWRITE_RIGHT, isolate); 324 Generate(Token::ADD, NUMBER, NUMBER, NUMBER, OVERWRITE_RIGHT, isolate);
318 Generate(Token::ADD, NUMBER, SMI, NUMBER, NO_OVERWRITE, isolate); 325 Generate(Token::ADD, NUMBER, SMI, NUMBER, NO_OVERWRITE, isolate);
319 Generate(Token::ADD, NUMBER, SMI, NUMBER, OVERWRITE_LEFT, isolate); 326 Generate(Token::ADD, NUMBER, SMI, NUMBER, OVERWRITE_LEFT, isolate);
320 Generate(Token::ADD, NUMBER, SMI, NUMBER, OVERWRITE_RIGHT, isolate); 327 Generate(Token::ADD, NUMBER, SMI, NUMBER, OVERWRITE_RIGHT, isolate);
321 Generate(Token::ADD, SMI, INT32, INT32, NO_OVERWRITE, isolate); 328 Generate(Token::ADD, SMI, INT32, INT32, NO_OVERWRITE, isolate);
322 Generate(Token::ADD, SMI, INT32, INT32, OVERWRITE_LEFT, isolate); 329 Generate(Token::ADD, SMI, INT32, INT32, OVERWRITE_LEFT, isolate);
323 Generate(Token::ADD, SMI, INT32, NUMBER, NO_OVERWRITE, isolate); 330 Generate(Token::ADD, SMI, INT32, NUMBER, NO_OVERWRITE, isolate);
324 Generate(Token::ADD, SMI, NUMBER, NUMBER, NO_OVERWRITE, isolate); 331 Generate(Token::ADD, SMI, NUMBER, NUMBER, NO_OVERWRITE, isolate);
325 Generate(Token::ADD, SMI, NUMBER, NUMBER, OVERWRITE_LEFT, isolate); 332 Generate(Token::ADD, SMI, NUMBER, NUMBER, OVERWRITE_LEFT, isolate);
326 Generate(Token::ADD, SMI, NUMBER, NUMBER, OVERWRITE_RIGHT, isolate); 333 Generate(Token::ADD, SMI, NUMBER, NUMBER, OVERWRITE_RIGHT, isolate);
327 Generate(Token::ADD, SMI, SMI, INT32, OVERWRITE_LEFT, isolate); 334 Generate(Token::ADD, SMI, SMI, INT32, OVERWRITE_LEFT, isolate);
328 Generate(Token::ADD, SMI, SMI, SMI, OVERWRITE_RIGHT, isolate); 335 Generate(Token::ADD, SMI, SMI, SMI, OVERWRITE_RIGHT, isolate);
329 Generate(Token::ADD, STRING, GENERIC, STRING, NO_OVERWRITE, isolate);
330 Generate(Token::ADD, STRING, GENERIC, STRING, OVERWRITE_LEFT, isolate);
331 Generate(Token::ADD, STRING, GENERIC, STRING, OVERWRITE_RIGHT, isolate);
332 Generate(Token::ADD, STRING, STRING, STRING, NO_OVERWRITE, isolate);
333 Generate(Token::ADD, STRING, STRING, STRING, OVERWRITE_LEFT, isolate);
334 Generate(Token::ADD, STRING, STRING, STRING, OVERWRITE_RIGHT, isolate);
335 Generate(Token::BIT_AND, INT32, INT32, INT32, NO_OVERWRITE, isolate); 336 Generate(Token::BIT_AND, INT32, INT32, INT32, NO_OVERWRITE, isolate);
336 Generate(Token::BIT_AND, INT32, INT32, INT32, OVERWRITE_LEFT, isolate); 337 Generate(Token::BIT_AND, INT32, INT32, INT32, OVERWRITE_LEFT, isolate);
337 Generate(Token::BIT_AND, INT32, INT32, INT32, OVERWRITE_RIGHT, isolate); 338 Generate(Token::BIT_AND, INT32, INT32, INT32, OVERWRITE_RIGHT, isolate);
338 Generate(Token::BIT_AND, INT32, INT32, SMI, NO_OVERWRITE, isolate); 339 Generate(Token::BIT_AND, INT32, INT32, SMI, NO_OVERWRITE, isolate);
339 Generate(Token::BIT_AND, INT32, INT32, SMI, OVERWRITE_RIGHT, isolate); 340 Generate(Token::BIT_AND, INT32, INT32, SMI, OVERWRITE_RIGHT, isolate);
340 Generate(Token::BIT_AND, INT32, SMI, INT32, NO_OVERWRITE, isolate); 341 Generate(Token::BIT_AND, INT32, SMI, INT32, NO_OVERWRITE, isolate);
341 Generate(Token::BIT_AND, INT32, SMI, INT32, OVERWRITE_RIGHT, isolate); 342 Generate(Token::BIT_AND, INT32, SMI, INT32, OVERWRITE_RIGHT, isolate);
342 Generate(Token::BIT_AND, INT32, SMI, SMI, NO_OVERWRITE, isolate); 343 Generate(Token::BIT_AND, INT32, SMI, SMI, NO_OVERWRITE, isolate);
343 Generate(Token::BIT_AND, INT32, SMI, SMI, OVERWRITE_LEFT, isolate); 344 Generate(Token::BIT_AND, INT32, SMI, SMI, OVERWRITE_LEFT, isolate);
344 Generate(Token::BIT_AND, INT32, SMI, SMI, OVERWRITE_RIGHT, isolate); 345 Generate(Token::BIT_AND, INT32, SMI, SMI, OVERWRITE_RIGHT, isolate);
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 InstallDescriptor(isolate, &stub3); 1154 InstallDescriptor(isolate, &stub3);
1154 } 1155 }
1155 1156
1156 InternalArrayConstructorStub::InternalArrayConstructorStub( 1157 InternalArrayConstructorStub::InternalArrayConstructorStub(
1157 Isolate* isolate) { 1158 Isolate* isolate) {
1158 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 1159 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
1159 } 1160 }
1160 1161
1161 1162
1162 } } // namespace v8::internal 1163 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/ia32/assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698