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

Side by Side Diff: src/ia32/assembler-ia32-inl.h

Issue 14403015: Disallow dereferencing deferred handles when generating optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 8 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/ia32/assembler-ia32.cc ('k') | src/ia32/lithium-codegen-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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 323 }
324 324
325 325
326 Immediate::Immediate(Label* internal_offset) { 326 Immediate::Immediate(Label* internal_offset) {
327 x_ = reinterpret_cast<int32_t>(internal_offset); 327 x_ = reinterpret_cast<int32_t>(internal_offset);
328 rmode_ = RelocInfo::INTERNAL_REFERENCE; 328 rmode_ = RelocInfo::INTERNAL_REFERENCE;
329 } 329 }
330 330
331 331
332 Immediate::Immediate(Handle<Object> handle) { 332 Immediate::Immediate(Handle<Object> handle) {
333 #ifdef DEBUG
334 Isolate* isolate = Isolate::Current();
335 #endif
336 ALLOW_HANDLE_DEREF(isolate,
337 "using and embedding raw address, heap object check");
333 // Verify all Objects referred by code are NOT in new space. 338 // Verify all Objects referred by code are NOT in new space.
334 Object* obj = *handle; 339 Object* obj = *handle;
335 ASSERT(!HEAP->InNewSpace(obj)); 340 ASSERT(!isolate->heap()->InNewSpace(obj));
336 if (obj->IsHeapObject()) { 341 if (obj->IsHeapObject()) {
337 x_ = reinterpret_cast<intptr_t>(handle.location()); 342 x_ = reinterpret_cast<intptr_t>(handle.location());
338 rmode_ = RelocInfo::EMBEDDED_OBJECT; 343 rmode_ = RelocInfo::EMBEDDED_OBJECT;
339 } else { 344 } else {
340 // no relocation needed 345 // no relocation needed
341 x_ = reinterpret_cast<intptr_t>(obj); 346 x_ = reinterpret_cast<intptr_t>(obj);
342 rmode_ = RelocInfo::NONE32; 347 rmode_ = RelocInfo::NONE32;
343 } 348 }
344 } 349 }
345 350
(...skipping 10 matching lines...) Expand all
356 } 361 }
357 362
358 363
359 void Assembler::emit(uint32_t x) { 364 void Assembler::emit(uint32_t x) {
360 *reinterpret_cast<uint32_t*>(pc_) = x; 365 *reinterpret_cast<uint32_t*>(pc_) = x;
361 pc_ += sizeof(uint32_t); 366 pc_ += sizeof(uint32_t);
362 } 367 }
363 368
364 369
365 void Assembler::emit(Handle<Object> handle) { 370 void Assembler::emit(Handle<Object> handle) {
371 ALLOW_HANDLE_DEREF(isolate(), "heap object check");
366 // Verify all Objects referred by code are NOT in new space. 372 // Verify all Objects referred by code are NOT in new space.
367 Object* obj = *handle; 373 Object* obj = *handle;
368 ASSERT(!isolate()->heap()->InNewSpace(obj)); 374 ASSERT(!isolate()->heap()->InNewSpace(obj));
369 if (obj->IsHeapObject()) { 375 if (obj->IsHeapObject()) {
370 emit(reinterpret_cast<intptr_t>(handle.location()), 376 emit(reinterpret_cast<intptr_t>(handle.location()),
371 RelocInfo::EMBEDDED_OBJECT); 377 RelocInfo::EMBEDDED_OBJECT);
372 } else { 378 } else {
373 // no relocation needed 379 // no relocation needed
374 emit(reinterpret_cast<intptr_t>(obj)); 380 emit(reinterpret_cast<intptr_t>(obj));
375 } 381 }
376 } 382 }
377 383
378 384
379 void Assembler::emit(uint32_t x, RelocInfo::Mode rmode, TypeFeedbackId id) { 385 void Assembler::emit(uint32_t x, RelocInfo::Mode rmode, TypeFeedbackId id) {
380 if (rmode == RelocInfo::CODE_TARGET && !id.IsNone()) { 386 if (rmode == RelocInfo::CODE_TARGET && !id.IsNone()) {
381 RecordRelocInfo(RelocInfo::CODE_TARGET_WITH_ID, id.ToInt()); 387 RecordRelocInfo(RelocInfo::CODE_TARGET_WITH_ID, id.ToInt());
382 } else if (!RelocInfo::IsNone(rmode)) { 388 } else if (!RelocInfo::IsNone(rmode)) {
383 RecordRelocInfo(rmode); 389 RecordRelocInfo(rmode);
384 } 390 }
385 emit(x); 391 emit(x);
386 } 392 }
387 393
388 394
395 void Assembler::emit(Handle<Code> code,
396 RelocInfo::Mode rmode,
397 TypeFeedbackId id) {
398 ALLOW_HANDLE_DEREF(isolate(), "embedding raw address");
399 emit(reinterpret_cast<intptr_t>(code.location()), rmode, id);
400 }
401
402
389 void Assembler::emit(const Immediate& x) { 403 void Assembler::emit(const Immediate& x) {
390 if (x.rmode_ == RelocInfo::INTERNAL_REFERENCE) { 404 if (x.rmode_ == RelocInfo::INTERNAL_REFERENCE) {
391 Label* label = reinterpret_cast<Label*>(x.x_); 405 Label* label = reinterpret_cast<Label*>(x.x_);
392 emit_code_relative_offset(label); 406 emit_code_relative_offset(label);
393 return; 407 return;
394 } 408 }
395 if (!RelocInfo::IsNone(x.rmode_)) RecordRelocInfo(x.rmode_); 409 if (!RelocInfo::IsNone(x.rmode_)) RecordRelocInfo(x.rmode_);
396 emit(x.x_); 410 emit(x.x_);
397 } 411 }
398 412
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 521
508 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { 522 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) {
509 // [disp/r] 523 // [disp/r]
510 set_modrm(0, ebp); 524 set_modrm(0, ebp);
511 set_dispr(disp, rmode); 525 set_dispr(disp, rmode);
512 } 526 }
513 527
514 } } // namespace v8::internal 528 } } // namespace v8::internal
515 529
516 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ 530 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698