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

Side by Side Diff: src/lithium.h

Issue 10534006: Remove TLS access for current Zone. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review. Created 8 years, 6 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/list-inl.h ('k') | src/lithium.cc » ('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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 181
182 int virtual_register() const { 182 int virtual_register() const {
183 return VirtualRegisterField::decode(value_); 183 return VirtualRegisterField::decode(value_);
184 } 184 }
185 185
186 void set_virtual_register(unsigned id) { 186 void set_virtual_register(unsigned id) {
187 value_ = VirtualRegisterField::update(value_, id); 187 value_ = VirtualRegisterField::update(value_, id);
188 } 188 }
189 189
190 LUnallocated* CopyUnconstrained() { 190 LUnallocated* CopyUnconstrained(Zone* zone) {
191 LUnallocated* result = new LUnallocated(ANY); 191 LUnallocated* result = new(zone) LUnallocated(ANY);
192 result->set_virtual_register(virtual_register()); 192 result->set_virtual_register(virtual_register());
193 return result; 193 return result;
194 } 194 }
195 195
196 static LUnallocated* cast(LOperand* op) { 196 static LUnallocated* cast(LOperand* op) {
197 ASSERT(op->IsUnallocated()); 197 ASSERT(op->IsUnallocated());
198 return reinterpret_cast<LUnallocated*>(op); 198 return reinterpret_cast<LUnallocated*>(op);
199 } 199 }
200 200
201 bool IsUsedAtStart() { 201 bool IsUsedAtStart() {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 253 }
254 254
255 private: 255 private:
256 LOperand* source_; 256 LOperand* source_;
257 LOperand* destination_; 257 LOperand* destination_;
258 }; 258 };
259 259
260 260
261 class LConstantOperand: public LOperand { 261 class LConstantOperand: public LOperand {
262 public: 262 public:
263 static LConstantOperand* Create(int index) { 263 static LConstantOperand* Create(int index, Zone* zone) {
264 ASSERT(index >= 0); 264 ASSERT(index >= 0);
265 if (index < kNumCachedOperands) return &cache[index]; 265 if (index < kNumCachedOperands) return &cache[index];
266 return new LConstantOperand(index); 266 return new(zone) LConstantOperand(index);
267 } 267 }
268 268
269 static LConstantOperand* cast(LOperand* op) { 269 static LConstantOperand* cast(LOperand* op) {
270 ASSERT(op->IsConstantOperand()); 270 ASSERT(op->IsConstantOperand());
271 return reinterpret_cast<LConstantOperand*>(op); 271 return reinterpret_cast<LConstantOperand*>(op);
272 } 272 }
273 273
274 static void SetUpCache(); 274 static void SetUpCache();
275 static void TearDownCache(); 275 static void TearDownCache();
276 276
(...skipping 12 matching lines...) Expand all
289 289
290 static LArgument* cast(LOperand* op) { 290 static LArgument* cast(LOperand* op) {
291 ASSERT(op->IsArgument()); 291 ASSERT(op->IsArgument());
292 return reinterpret_cast<LArgument*>(op); 292 return reinterpret_cast<LArgument*>(op);
293 } 293 }
294 }; 294 };
295 295
296 296
297 class LStackSlot: public LOperand { 297 class LStackSlot: public LOperand {
298 public: 298 public:
299 static LStackSlot* Create(int index) { 299 static LStackSlot* Create(int index, Zone* zone) {
300 ASSERT(index >= 0); 300 ASSERT(index >= 0);
301 if (index < kNumCachedOperands) return &cache[index]; 301 if (index < kNumCachedOperands) return &cache[index];
302 return new LStackSlot(index); 302 return new(zone) LStackSlot(index);
303 } 303 }
304 304
305 static LStackSlot* cast(LOperand* op) { 305 static LStackSlot* cast(LOperand* op) {
306 ASSERT(op->IsStackSlot()); 306 ASSERT(op->IsStackSlot());
307 return reinterpret_cast<LStackSlot*>(op); 307 return reinterpret_cast<LStackSlot*>(op);
308 } 308 }
309 309
310 static void SetUpCache(); 310 static void SetUpCache();
311 static void TearDownCache(); 311 static void TearDownCache();
312 312
313 private: 313 private:
314 static const int kNumCachedOperands = 128; 314 static const int kNumCachedOperands = 128;
315 static LStackSlot* cache; 315 static LStackSlot* cache;
316 316
317 LStackSlot() : LOperand() { } 317 LStackSlot() : LOperand() { }
318 explicit LStackSlot(int index) : LOperand(STACK_SLOT, index) { } 318 explicit LStackSlot(int index) : LOperand(STACK_SLOT, index) { }
319 }; 319 };
320 320
321 321
322 class LDoubleStackSlot: public LOperand { 322 class LDoubleStackSlot: public LOperand {
323 public: 323 public:
324 static LDoubleStackSlot* Create(int index) { 324 static LDoubleStackSlot* Create(int index, Zone* zone) {
325 ASSERT(index >= 0); 325 ASSERT(index >= 0);
326 if (index < kNumCachedOperands) return &cache[index]; 326 if (index < kNumCachedOperands) return &cache[index];
327 return new LDoubleStackSlot(index); 327 return new(zone) LDoubleStackSlot(index);
328 } 328 }
329 329
330 static LDoubleStackSlot* cast(LOperand* op) { 330 static LDoubleStackSlot* cast(LOperand* op) {
331 ASSERT(op->IsStackSlot()); 331 ASSERT(op->IsStackSlot());
332 return reinterpret_cast<LDoubleStackSlot*>(op); 332 return reinterpret_cast<LDoubleStackSlot*>(op);
333 } 333 }
334 334
335 static void SetUpCache(); 335 static void SetUpCache();
336 static void TearDownCache(); 336 static void TearDownCache();
337 337
338 private: 338 private:
339 static const int kNumCachedOperands = 128; 339 static const int kNumCachedOperands = 128;
340 static LDoubleStackSlot* cache; 340 static LDoubleStackSlot* cache;
341 341
342 LDoubleStackSlot() : LOperand() { } 342 LDoubleStackSlot() : LOperand() { }
343 explicit LDoubleStackSlot(int index) : LOperand(DOUBLE_STACK_SLOT, index) { } 343 explicit LDoubleStackSlot(int index) : LOperand(DOUBLE_STACK_SLOT, index) { }
344 }; 344 };
345 345
346 346
347 class LRegister: public LOperand { 347 class LRegister: public LOperand {
348 public: 348 public:
349 static LRegister* Create(int index) { 349 static LRegister* Create(int index, Zone* zone) {
350 ASSERT(index >= 0); 350 ASSERT(index >= 0);
351 if (index < kNumCachedOperands) return &cache[index]; 351 if (index < kNumCachedOperands) return &cache[index];
352 return new LRegister(index); 352 return new(zone) LRegister(index);
353 } 353 }
354 354
355 static LRegister* cast(LOperand* op) { 355 static LRegister* cast(LOperand* op) {
356 ASSERT(op->IsRegister()); 356 ASSERT(op->IsRegister());
357 return reinterpret_cast<LRegister*>(op); 357 return reinterpret_cast<LRegister*>(op);
358 } 358 }
359 359
360 static void SetUpCache(); 360 static void SetUpCache();
361 static void TearDownCache(); 361 static void TearDownCache();
362 362
363 private: 363 private:
364 static const int kNumCachedOperands = 16; 364 static const int kNumCachedOperands = 16;
365 static LRegister* cache; 365 static LRegister* cache;
366 366
367 LRegister() : LOperand() { } 367 LRegister() : LOperand() { }
368 explicit LRegister(int index) : LOperand(REGISTER, index) { } 368 explicit LRegister(int index) : LOperand(REGISTER, index) { }
369 }; 369 };
370 370
371 371
372 class LDoubleRegister: public LOperand { 372 class LDoubleRegister: public LOperand {
373 public: 373 public:
374 static LDoubleRegister* Create(int index) { 374 static LDoubleRegister* Create(int index, Zone* zone) {
375 ASSERT(index >= 0); 375 ASSERT(index >= 0);
376 if (index < kNumCachedOperands) return &cache[index]; 376 if (index < kNumCachedOperands) return &cache[index];
377 return new LDoubleRegister(index); 377 return new(zone) LDoubleRegister(index);
378 } 378 }
379 379
380 static LDoubleRegister* cast(LOperand* op) { 380 static LDoubleRegister* cast(LOperand* op) {
381 ASSERT(op->IsDoubleRegister()); 381 ASSERT(op->IsDoubleRegister());
382 return reinterpret_cast<LDoubleRegister*>(op); 382 return reinterpret_cast<LDoubleRegister*>(op);
383 } 383 }
384 384
385 static void SetUpCache(); 385 static void SetUpCache();
386 static void TearDownCache(); 386 static void TearDownCache();
387 387
388 private: 388 private:
389 static const int kNumCachedOperands = 16; 389 static const int kNumCachedOperands = 16;
390 static LDoubleRegister* cache; 390 static LDoubleRegister* cache;
391 391
392 LDoubleRegister() : LOperand() { } 392 LDoubleRegister() : LOperand() { }
393 explicit LDoubleRegister(int index) : LOperand(DOUBLE_REGISTER, index) { } 393 explicit LDoubleRegister(int index) : LOperand(DOUBLE_REGISTER, index) { }
394 }; 394 };
395 395
396 396
397 class LParallelMove : public ZoneObject { 397 class LParallelMove : public ZoneObject {
398 public: 398 public:
399 LParallelMove() : move_operands_(4) { } 399 explicit LParallelMove(Zone* zone) : move_operands_(4, zone) { }
400 400
401 void AddMove(LOperand* from, LOperand* to) { 401 void AddMove(LOperand* from, LOperand* to, Zone* zone) {
402 move_operands_.Add(LMoveOperands(from, to)); 402 move_operands_.Add(LMoveOperands(from, to), zone);
403 } 403 }
404 404
405 bool IsRedundant() const; 405 bool IsRedundant() const;
406 406
407 const ZoneList<LMoveOperands>* move_operands() const { 407 const ZoneList<LMoveOperands>* move_operands() const {
408 return &move_operands_; 408 return &move_operands_;
409 } 409 }
410 410
411 void PrintDataTo(StringStream* stream) const; 411 void PrintDataTo(StringStream* stream) const;
412 412
413 private: 413 private:
414 ZoneList<LMoveOperands> move_operands_; 414 ZoneList<LMoveOperands> move_operands_;
415 }; 415 };
416 416
417 417
418 class LPointerMap: public ZoneObject { 418 class LPointerMap: public ZoneObject {
419 public: 419 public:
420 explicit LPointerMap(int position) 420 explicit LPointerMap(int position, Zone* zone)
421 : pointer_operands_(8), 421 : pointer_operands_(8, zone),
422 untagged_operands_(0), 422 untagged_operands_(0, zone),
423 position_(position), 423 position_(position),
424 lithium_position_(-1) { } 424 lithium_position_(-1) { }
425 425
426 const ZoneList<LOperand*>* GetNormalizedOperands() { 426 const ZoneList<LOperand*>* GetNormalizedOperands() {
427 for (int i = 0; i < untagged_operands_.length(); ++i) { 427 for (int i = 0; i < untagged_operands_.length(); ++i) {
428 RemovePointer(untagged_operands_[i]); 428 RemovePointer(untagged_operands_[i]);
429 } 429 }
430 untagged_operands_.Clear(); 430 untagged_operands_.Clear();
431 return &pointer_operands_; 431 return &pointer_operands_;
432 } 432 }
433 int position() const { return position_; } 433 int position() const { return position_; }
434 int lithium_position() const { return lithium_position_; } 434 int lithium_position() const { return lithium_position_; }
435 435
436 void set_lithium_position(int pos) { 436 void set_lithium_position(int pos) {
437 ASSERT(lithium_position_ == -1); 437 ASSERT(lithium_position_ == -1);
438 lithium_position_ = pos; 438 lithium_position_ = pos;
439 } 439 }
440 440
441 void RecordPointer(LOperand* op); 441 void RecordPointer(LOperand* op, Zone* zone);
442 void RemovePointer(LOperand* op); 442 void RemovePointer(LOperand* op);
443 void RecordUntagged(LOperand* op); 443 void RecordUntagged(LOperand* op, Zone* zone);
444 void PrintTo(StringStream* stream); 444 void PrintTo(StringStream* stream);
445 445
446 private: 446 private:
447 ZoneList<LOperand*> pointer_operands_; 447 ZoneList<LOperand*> pointer_operands_;
448 ZoneList<LOperand*> untagged_operands_; 448 ZoneList<LOperand*> untagged_operands_;
449 int position_; 449 int position_;
450 int lithium_position_; 450 int lithium_position_;
451 }; 451 };
452 452
453 453
454 class LEnvironment: public ZoneObject { 454 class LEnvironment: public ZoneObject {
455 public: 455 public:
456 LEnvironment(Handle<JSFunction> closure, 456 LEnvironment(Handle<JSFunction> closure,
457 FrameType frame_type, 457 FrameType frame_type,
458 int ast_id, 458 int ast_id,
459 int parameter_count, 459 int parameter_count,
460 int argument_count, 460 int argument_count,
461 int value_count, 461 int value_count,
462 LEnvironment* outer, 462 LEnvironment* outer,
463 Zone* zone) 463 Zone* zone)
464 : closure_(closure), 464 : closure_(closure),
465 frame_type_(frame_type), 465 frame_type_(frame_type),
466 arguments_stack_height_(argument_count), 466 arguments_stack_height_(argument_count),
467 deoptimization_index_(Safepoint::kNoDeoptimizationIndex), 467 deoptimization_index_(Safepoint::kNoDeoptimizationIndex),
468 translation_index_(-1), 468 translation_index_(-1),
469 ast_id_(ast_id), 469 ast_id_(ast_id),
470 parameter_count_(parameter_count), 470 parameter_count_(parameter_count),
471 pc_offset_(-1), 471 pc_offset_(-1),
472 values_(value_count), 472 values_(value_count, zone),
473 is_tagged_(value_count, closure->GetHeap()->isolate()->zone()), 473 is_tagged_(value_count, closure->GetHeap()->isolate()->zone()),
474 spilled_registers_(NULL), 474 spilled_registers_(NULL),
475 spilled_double_registers_(NULL), 475 spilled_double_registers_(NULL),
476 outer_(outer), 476 outer_(outer),
477 zone_(zone) { } 477 zone_(zone) { }
478 478
479 Handle<JSFunction> closure() const { return closure_; } 479 Handle<JSFunction> closure() const { return closure_; }
480 FrameType frame_type() const { return frame_type_; } 480 FrameType frame_type() const { return frame_type_; }
481 int arguments_stack_height() const { return arguments_stack_height_; } 481 int arguments_stack_height() const { return arguments_stack_height_; }
482 int deoptimization_index() const { return deoptimization_index_; } 482 int deoptimization_index() const { return deoptimization_index_; }
483 int translation_index() const { return translation_index_; } 483 int translation_index() const { return translation_index_; }
484 int ast_id() const { return ast_id_; } 484 int ast_id() const { return ast_id_; }
485 int parameter_count() const { return parameter_count_; } 485 int parameter_count() const { return parameter_count_; }
486 int pc_offset() const { return pc_offset_; } 486 int pc_offset() const { return pc_offset_; }
487 LOperand** spilled_registers() const { return spilled_registers_; } 487 LOperand** spilled_registers() const { return spilled_registers_; }
488 LOperand** spilled_double_registers() const { 488 LOperand** spilled_double_registers() const {
489 return spilled_double_registers_; 489 return spilled_double_registers_;
490 } 490 }
491 const ZoneList<LOperand*>* values() const { return &values_; } 491 const ZoneList<LOperand*>* values() const { return &values_; }
492 LEnvironment* outer() const { return outer_; } 492 LEnvironment* outer() const { return outer_; }
493 493
494 void AddValue(LOperand* operand, Representation representation) { 494 void AddValue(LOperand* operand, Representation representation) {
495 values_.Add(operand); 495 values_.Add(operand, zone());
496 if (representation.IsTagged()) { 496 if (representation.IsTagged()) {
497 is_tagged_.Add(values_.length() - 1); 497 is_tagged_.Add(values_.length() - 1);
498 } 498 }
499 } 499 }
500 500
501 bool HasTaggedValueAt(int index) const { 501 bool HasTaggedValueAt(int index) const {
502 return is_tagged_.Contains(index); 502 return is_tagged_.Contains(index);
503 } 503 }
504 504
505 void Register(int deoptimization_index, 505 void Register(int deoptimization_index,
506 int translation_index, 506 int translation_index,
507 int pc_offset) { 507 int pc_offset) {
508 ASSERT(!HasBeenRegistered()); 508 ASSERT(!HasBeenRegistered());
509 deoptimization_index_ = deoptimization_index; 509 deoptimization_index_ = deoptimization_index;
510 translation_index_ = translation_index; 510 translation_index_ = translation_index;
511 pc_offset_ = pc_offset; 511 pc_offset_ = pc_offset;
512 } 512 }
513 bool HasBeenRegistered() const { 513 bool HasBeenRegistered() const {
514 return deoptimization_index_ != Safepoint::kNoDeoptimizationIndex; 514 return deoptimization_index_ != Safepoint::kNoDeoptimizationIndex;
515 } 515 }
516 516
517 void SetSpilledRegisters(LOperand** registers, 517 void SetSpilledRegisters(LOperand** registers,
518 LOperand** double_registers) { 518 LOperand** double_registers) {
519 spilled_registers_ = registers; 519 spilled_registers_ = registers;
520 spilled_double_registers_ = double_registers; 520 spilled_double_registers_ = double_registers;
521 } 521 }
522 522
523 void PrintTo(StringStream* stream); 523 void PrintTo(StringStream* stream);
524 524
525 Zone* zone() { return zone_; } 525 Zone* zone() const { return zone_; }
526 526
527 private: 527 private:
528 Handle<JSFunction> closure_; 528 Handle<JSFunction> closure_;
529 FrameType frame_type_; 529 FrameType frame_type_;
530 int arguments_stack_height_; 530 int arguments_stack_height_;
531 int deoptimization_index_; 531 int deoptimization_index_;
532 int translation_index_; 532 int translation_index_;
533 int ast_id_; 533 int ast_id_;
534 int parameter_count_; 534 int parameter_count_;
535 int pc_offset_; 535 int pc_offset_;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 ShallowIterator current_iterator_; 621 ShallowIterator current_iterator_;
622 }; 622 };
623 623
624 624
625 int ElementsKindToShiftSize(ElementsKind elements_kind); 625 int ElementsKindToShiftSize(ElementsKind elements_kind);
626 626
627 627
628 } } // namespace v8::internal 628 } } // namespace v8::internal
629 629
630 #endif // V8_LITHIUM_H_ 630 #endif // V8_LITHIUM_H_
OLDNEW
« no previous file with comments | « src/list-inl.h ('k') | src/lithium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698