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

Side by Side Diff: src/platform.h

Issue 40290: Experimental: Merge 1395:1441 from bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/global/
Patch Set: Created 11 years, 9 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/parser.cc ('k') | src/platform-freebsd.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 // Server initialization. 430 // Server initialization.
431 virtual bool Bind(const int port) = 0; 431 virtual bool Bind(const int port) = 0;
432 virtual bool Listen(int backlog) const = 0; 432 virtual bool Listen(int backlog) const = 0;
433 virtual Socket* Accept() const = 0; 433 virtual Socket* Accept() const = 0;
434 434
435 // Client initialization. 435 // Client initialization.
436 virtual bool Connect(const char* host, const char* port) = 0; 436 virtual bool Connect(const char* host, const char* port) = 0;
437 437
438 // Data Transimission 438 // Data Transimission
439 virtual int Send(const char* data, int len) const = 0; 439 virtual int Send(const char* data, int len) const = 0;
440 virtual bool SendAll(const char* data, int len) const = 0;
441 virtual int Receive(char* data, int len) const = 0; 440 virtual int Receive(char* data, int len) const = 0;
442 441
443 virtual bool IsValid() const = 0; 442 virtual bool IsValid() const = 0;
444 443
445 static bool Setup(); 444 static bool Setup();
446 static int LastError(); 445 static int LastError();
447 static uint16_t HToN(uint16_t value); 446 static uint16_t HToN(uint16_t value);
448 static uint16_t NToH(uint16_t value); 447 static uint16_t NToH(uint16_t value);
449 static uint32_t HToN(uint32_t value); 448 static uint32_t HToN(uint32_t value);
450 static uint32_t NToH(uint32_t value); 449 static uint32_t NToH(uint32_t value);
451 }; 450 };
452 451
453 452
454 #ifdef ENABLE_LOGGING_AND_PROFILING 453 #ifdef ENABLE_LOGGING_AND_PROFILING
455 // ---------------------------------------------------------------------------- 454 // ----------------------------------------------------------------------------
456 // Sampler 455 // Sampler
457 // 456 //
458 // A sampler periodically samples the state of the VM and optionally 457 // A sampler periodically samples the state of the VM and optionally
459 // (if used for profiling) the program counter and stack pointer for 458 // (if used for profiling) the program counter and stack pointer for
460 // the thread that created it. 459 // the thread that created it.
461 460
462 // TickSample captures the information collected for each sample. 461 // TickSample captures the information collected for each sample.
463 class TickSample { 462 class TickSample {
464 public: 463 public:
465 TickSample() : pc(0), sp(0), fp(0), state(OTHER) {} 464 TickSample() : pc(0), sp(0), fp(0), state(OTHER) {}
466 unsigned int pc; // Instruction pointer. 465 unsigned int pc; // Instruction pointer.
467 unsigned int sp; // Stack pointer. 466 unsigned int sp; // Stack pointer.
468 unsigned int fp; // Frame pointer. 467 unsigned int fp; // Frame pointer.
469 StateTag state; // The state of the VM. 468 StateTag state; // The state of the VM.
470 SmartPointer<Address> stack; // Call stack, null-terminated. 469 static const int kMaxFramesCount = 5;
471 470 EmbeddedVector<Address, kMaxFramesCount> stack; // Call stack.
472 inline TickSample& operator=(const TickSample& rhs) { 471 int frames_count; // Number of captured frames.
473 if (this == &rhs) return *this;
474 pc = rhs.pc;
475 sp = rhs.sp;
476 fp = rhs.fp;
477 state = rhs.state;
478 DeleteArray(stack.Detach());
479 stack = rhs.stack;
480 return *this;
481 }
482
483 inline void InitStack(int depth) {
484 stack = SmartPointer<Address>(NewArray<Address>(depth + 1));
485 // null-terminate
486 stack[depth] = 0;
487 }
488 }; 472 };
489 473
490 class Sampler { 474 class Sampler {
491 public: 475 public:
492 // Initialize sampler. 476 // Initialize sampler.
493 explicit Sampler(int interval, bool profiling); 477 explicit Sampler(int interval, bool profiling);
494 virtual ~Sampler(); 478 virtual ~Sampler();
495 479
496 // This method is called for each sampling period with the current 480 // This method is called for each sampling period with the current
497 // program counter. 481 // program counter.
(...skipping 16 matching lines...) Expand all
514 bool active_; 498 bool active_;
515 PlatformData* data_; // Platform specific data. 499 PlatformData* data_; // Platform specific data.
516 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); 500 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler);
517 }; 501 };
518 502
519 #endif // ENABLE_LOGGING_AND_PROFILING 503 #endif // ENABLE_LOGGING_AND_PROFILING
520 504
521 } } // namespace v8::internal 505 } } // namespace v8::internal
522 506
523 #endif // V8_PLATFORM_H_ 507 #endif // V8_PLATFORM_H_
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698