| OLD | NEW |
| 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 ASSERT(index >= 0); | 258 ASSERT(index >= 0); |
| 259 if (index < kNumCachedOperands) return &cache[index]; | 259 if (index < kNumCachedOperands) return &cache[index]; |
| 260 return new LConstantOperand(index); | 260 return new LConstantOperand(index); |
| 261 } | 261 } |
| 262 | 262 |
| 263 static LConstantOperand* cast(LOperand* op) { | 263 static LConstantOperand* cast(LOperand* op) { |
| 264 ASSERT(op->IsConstantOperand()); | 264 ASSERT(op->IsConstantOperand()); |
| 265 return reinterpret_cast<LConstantOperand*>(op); | 265 return reinterpret_cast<LConstantOperand*>(op); |
| 266 } | 266 } |
| 267 | 267 |
| 268 static void SetupCache(); | 268 static void SetUpCache(); |
| 269 | 269 |
| 270 private: | 270 private: |
| 271 static const int kNumCachedOperands = 128; | 271 static const int kNumCachedOperands = 128; |
| 272 static LConstantOperand cache[]; | 272 static LConstantOperand cache[]; |
| 273 | 273 |
| 274 LConstantOperand() : LOperand() { } | 274 LConstantOperand() : LOperand() { } |
| 275 explicit LConstantOperand(int index) : LOperand(CONSTANT_OPERAND, index) { } | 275 explicit LConstantOperand(int index) : LOperand(CONSTANT_OPERAND, index) { } |
| 276 }; | 276 }; |
| 277 | 277 |
| 278 | 278 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 293 ASSERT(index >= 0); | 293 ASSERT(index >= 0); |
| 294 if (index < kNumCachedOperands) return &cache[index]; | 294 if (index < kNumCachedOperands) return &cache[index]; |
| 295 return new LStackSlot(index); | 295 return new LStackSlot(index); |
| 296 } | 296 } |
| 297 | 297 |
| 298 static LStackSlot* cast(LOperand* op) { | 298 static LStackSlot* cast(LOperand* op) { |
| 299 ASSERT(op->IsStackSlot()); | 299 ASSERT(op->IsStackSlot()); |
| 300 return reinterpret_cast<LStackSlot*>(op); | 300 return reinterpret_cast<LStackSlot*>(op); |
| 301 } | 301 } |
| 302 | 302 |
| 303 static void SetupCache(); | 303 static void SetUpCache(); |
| 304 | 304 |
| 305 private: | 305 private: |
| 306 static const int kNumCachedOperands = 128; | 306 static const int kNumCachedOperands = 128; |
| 307 static LStackSlot cache[]; | 307 static LStackSlot cache[]; |
| 308 | 308 |
| 309 LStackSlot() : LOperand() { } | 309 LStackSlot() : LOperand() { } |
| 310 explicit LStackSlot(int index) : LOperand(STACK_SLOT, index) { } | 310 explicit LStackSlot(int index) : LOperand(STACK_SLOT, index) { } |
| 311 }; | 311 }; |
| 312 | 312 |
| 313 | 313 |
| 314 class LDoubleStackSlot: public LOperand { | 314 class LDoubleStackSlot: public LOperand { |
| 315 public: | 315 public: |
| 316 static LDoubleStackSlot* Create(int index) { | 316 static LDoubleStackSlot* Create(int index) { |
| 317 ASSERT(index >= 0); | 317 ASSERT(index >= 0); |
| 318 if (index < kNumCachedOperands) return &cache[index]; | 318 if (index < kNumCachedOperands) return &cache[index]; |
| 319 return new LDoubleStackSlot(index); | 319 return new LDoubleStackSlot(index); |
| 320 } | 320 } |
| 321 | 321 |
| 322 static LDoubleStackSlot* cast(LOperand* op) { | 322 static LDoubleStackSlot* cast(LOperand* op) { |
| 323 ASSERT(op->IsStackSlot()); | 323 ASSERT(op->IsStackSlot()); |
| 324 return reinterpret_cast<LDoubleStackSlot*>(op); | 324 return reinterpret_cast<LDoubleStackSlot*>(op); |
| 325 } | 325 } |
| 326 | 326 |
| 327 static void SetupCache(); | 327 static void SetUpCache(); |
| 328 | 328 |
| 329 private: | 329 private: |
| 330 static const int kNumCachedOperands = 128; | 330 static const int kNumCachedOperands = 128; |
| 331 static LDoubleStackSlot cache[]; | 331 static LDoubleStackSlot cache[]; |
| 332 | 332 |
| 333 LDoubleStackSlot() : LOperand() { } | 333 LDoubleStackSlot() : LOperand() { } |
| 334 explicit LDoubleStackSlot(int index) : LOperand(DOUBLE_STACK_SLOT, index) { } | 334 explicit LDoubleStackSlot(int index) : LOperand(DOUBLE_STACK_SLOT, index) { } |
| 335 }; | 335 }; |
| 336 | 336 |
| 337 | 337 |
| 338 class LRegister: public LOperand { | 338 class LRegister: public LOperand { |
| 339 public: | 339 public: |
| 340 static LRegister* Create(int index) { | 340 static LRegister* Create(int index) { |
| 341 ASSERT(index >= 0); | 341 ASSERT(index >= 0); |
| 342 if (index < kNumCachedOperands) return &cache[index]; | 342 if (index < kNumCachedOperands) return &cache[index]; |
| 343 return new LRegister(index); | 343 return new LRegister(index); |
| 344 } | 344 } |
| 345 | 345 |
| 346 static LRegister* cast(LOperand* op) { | 346 static LRegister* cast(LOperand* op) { |
| 347 ASSERT(op->IsRegister()); | 347 ASSERT(op->IsRegister()); |
| 348 return reinterpret_cast<LRegister*>(op); | 348 return reinterpret_cast<LRegister*>(op); |
| 349 } | 349 } |
| 350 | 350 |
| 351 static void SetupCache(); | 351 static void SetUpCache(); |
| 352 | 352 |
| 353 private: | 353 private: |
| 354 static const int kNumCachedOperands = 16; | 354 static const int kNumCachedOperands = 16; |
| 355 static LRegister cache[]; | 355 static LRegister cache[]; |
| 356 | 356 |
| 357 LRegister() : LOperand() { } | 357 LRegister() : LOperand() { } |
| 358 explicit LRegister(int index) : LOperand(REGISTER, index) { } | 358 explicit LRegister(int index) : LOperand(REGISTER, index) { } |
| 359 }; | 359 }; |
| 360 | 360 |
| 361 | 361 |
| 362 class LDoubleRegister: public LOperand { | 362 class LDoubleRegister: public LOperand { |
| 363 public: | 363 public: |
| 364 static LDoubleRegister* Create(int index) { | 364 static LDoubleRegister* Create(int index) { |
| 365 ASSERT(index >= 0); | 365 ASSERT(index >= 0); |
| 366 if (index < kNumCachedOperands) return &cache[index]; | 366 if (index < kNumCachedOperands) return &cache[index]; |
| 367 return new LDoubleRegister(index); | 367 return new LDoubleRegister(index); |
| 368 } | 368 } |
| 369 | 369 |
| 370 static LDoubleRegister* cast(LOperand* op) { | 370 static LDoubleRegister* cast(LOperand* op) { |
| 371 ASSERT(op->IsDoubleRegister()); | 371 ASSERT(op->IsDoubleRegister()); |
| 372 return reinterpret_cast<LDoubleRegister*>(op); | 372 return reinterpret_cast<LDoubleRegister*>(op); |
| 373 } | 373 } |
| 374 | 374 |
| 375 static void SetupCache(); | 375 static void SetUpCache(); |
| 376 | 376 |
| 377 private: | 377 private: |
| 378 static const int kNumCachedOperands = 16; | 378 static const int kNumCachedOperands = 16; |
| 379 static LDoubleRegister cache[]; | 379 static LDoubleRegister cache[]; |
| 380 | 380 |
| 381 LDoubleRegister() : LOperand() { } | 381 LDoubleRegister() : LOperand() { } |
| 382 explicit LDoubleRegister(int index) : LOperand(DOUBLE_REGISTER, index) { } | 382 explicit LDoubleRegister(int index) : LOperand(DOUBLE_REGISTER, index) { } |
| 383 }; | 383 }; |
| 384 | 384 |
| 385 | 385 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 ZoneList<LOperand*> values_; | 516 ZoneList<LOperand*> values_; |
| 517 ZoneList<Representation> representations_; | 517 ZoneList<Representation> representations_; |
| 518 | 518 |
| 519 // Allocation index indexed arrays of spill slot operands for registers | 519 // Allocation index indexed arrays of spill slot operands for registers |
| 520 // that are also in spill slots at an OSR entry. NULL for environments | 520 // that are also in spill slots at an OSR entry. NULL for environments |
| 521 // that do not correspond to an OSR entry. | 521 // that do not correspond to an OSR entry. |
| 522 LOperand** spilled_registers_; | 522 LOperand** spilled_registers_; |
| 523 LOperand** spilled_double_registers_; | 523 LOperand** spilled_double_registers_; |
| 524 | 524 |
| 525 LEnvironment* outer_; | 525 LEnvironment* outer_; |
| 526 | |
| 527 friend class LCodegen; | |
| 528 }; | 526 }; |
| 529 | 527 |
| 530 | 528 |
| 531 // Iterates over the non-null, non-constant operands in an environment. | 529 // Iterates over the non-null, non-constant operands in an environment. |
| 532 class ShallowIterator BASE_EMBEDDED { | 530 class ShallowIterator BASE_EMBEDDED { |
| 533 public: | 531 public: |
| 534 explicit ShallowIterator(LEnvironment* env) | 532 explicit ShallowIterator(LEnvironment* env) |
| 535 : env_(env), | 533 : env_(env), |
| 536 limit_(env != NULL ? env->values()->length() : 0), | 534 limit_(env != NULL ? env->values()->length() : 0), |
| 537 current_(0) { | 535 current_(0) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 ShallowIterator current_iterator_; | 599 ShallowIterator current_iterator_; |
| 602 }; | 600 }; |
| 603 | 601 |
| 604 | 602 |
| 605 int ElementsKindToShiftSize(ElementsKind elements_kind); | 603 int ElementsKindToShiftSize(ElementsKind elements_kind); |
| 606 | 604 |
| 607 | 605 |
| 608 } } // namespace v8::internal | 606 } } // namespace v8::internal |
| 609 | 607 |
| 610 #endif // V8_LITHIUM_H_ | 608 #endif // V8_LITHIUM_H_ |
| OLD | NEW |